From 29dfc0a9bf9c6d028b8c015952aef632214ca8a8 Mon Sep 17 00:00:00 2001 From: "asakurareiko@f3d908c71c009580228b264f63f21c7274df7476" Date: Fri, 22 Oct 2021 15:58:11 +0000 Subject: [PATCH] Added a comment --- ..._a87baf5ad6b7688bb40a6c463cb1b8db._comment | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 doc/todo/More_space_savings_for_annex.thin/comment_4_a87baf5ad6b7688bb40a6c463cb1b8db._comment diff --git a/doc/todo/More_space_savings_for_annex.thin/comment_4_a87baf5ad6b7688bb40a6c463cb1b8db._comment b/doc/todo/More_space_savings_for_annex.thin/comment_4_a87baf5ad6b7688bb40a6c463cb1b8db._comment new file mode 100644 index 0000000000..bf7dab77fc --- /dev/null +++ b/doc/todo/More_space_savings_for_annex.thin/comment_4_a87baf5ad6b7688bb40a6c463cb1b8db._comment @@ -0,0 +1,47 @@ +[[!comment format=mdwn + username="asakurareiko@f3d908c71c009580228b264f63f21c7274df7476" + nickname="asakurareiko" + avatar="http://cdn.libravatar.org/avatar/a865743e357add9d15081840179ce082" + subject="comment 4" + date="2021-10-22T15:58:11Z" + content=""" +I understand `annex.thinmode=forcehardlink` presents a greater risk. Personally that's something I can manage. In case anyone else is interested in doing the same, this patch will make `git annex fix` always create hardlinks with `annex.thin=true`. + +``` +diff --git a/Annex/Content/LowLevel.hs b/Annex/Content/LowLevel.hs +index c686e462e..b7cf95d24 100644 +--- a/Annex/Content/LowLevel.hs ++++ b/Annex/Content/LowLevel.hs +@@ -57,10 +57,8 @@ linkOrCopy' canhardlink key src dest destmode = catchDefaultIO Nothing $ + where + hardlink = do + s <- getstat +- if linkCount s > 1 +- then copy s +- else liftIO (R.createLink src dest >> preserveGitMode dest destmode >> return (Just Linked)) +- `catchIO` const (copy s) ++ liftIO (R.createLink src dest >> preserveGitMode dest destmode >> return (Just Linked)) ++ `catchIO` const (copy s) + copy s = ifM (checkedCopyFile' key src dest destmode s) + ( return (Just Copied) + , return Nothing +diff --git a/Command/Fix.hs b/Command/Fix.hs +index 6a84652ce..40a93b357 100644 +--- a/Command/Fix.hs ++++ b/Command/Fix.hs +@@ -62,10 +62,10 @@ start fixwhat si file key = do + thin <- annexThin <$> Annex.getGitConfig + fs <- liftIO $ catchMaybeIO $ R.getFileStatus file + os <- liftIO $ catchMaybeIO $ R.getFileStatus obj +- case (linkCount <$> fs, linkCount <$> os, thin) of +- (Just 1, Just 1, True) -> ++ case (fileID <$> fs, fileID <$> os, thin) of ++ (Just n, Just n', True) | n /= n' -> + fixby $ makeHardLink file key +- (Just n, Just n', False) | n > 1 && n == n' -> ++ (Just n, Just n', False) | n == n' -> + fixby $ breakHardLink file key obj + _ -> stop + +``` +"""]]