From 11dbb829bc12d36225729676bbf27424a312d9bb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 11 Dec 2018 13:05:03 -0400 Subject: [PATCH] Fix a case where upgrade to v7 caused git to think that unlocked files were modified When a file was already unlocked, but the annex object was present, the upgrade process populated the unlocked file, but neglected to update the index. This commit was sponsored by Jochen Bartl on Patreon. --- Annex/WorkTree.hs | 14 ++++++++++---- CHANGELOG | 2 ++ ...ent_5_ade6edafc859f53845fef5ba0c92fb1b._comment | 7 +++++++ 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 doc/forum/why_are_all_those_files_modified/comment_5_ade6edafc859f53845fef5ba0c92fb1b._comment diff --git a/Annex/WorkTree.hs b/Annex/WorkTree.hs index 89d80c0cae..84ee39f4c4 100644 --- a/Annex/WorkTree.hs +++ b/Annex/WorkTree.hs @@ -14,6 +14,8 @@ import Annex.Version import Annex.Content import Annex.ReplaceFile import Annex.CurrentBranch +import Annex.InodeSentinal +import Utility.InodeCache import Config import Git.FilePath import qualified Git.Ref @@ -84,9 +86,13 @@ scanUnlockedFiles = whenM (isJust <$> inRepo Git.Branch.current) $ do whenM (inAnnex k) $ do f <- fromRepo $ fromTopFilePath tf destmode <- liftIO $ catchMaybeIO $ fileMode <$> getFileStatus f - replaceFile f $ \tmp -> + ic <- replaceFile f $ \tmp -> linkFromAnnex k tmp destmode >>= \case - LinkAnnexOk -> return () - LinkAnnexNoop -> return () - LinkAnnexFailed -> liftIO $ + LinkAnnexOk -> + withTSDelta (liftIO . genInodeCache tmp) + LinkAnnexNoop -> return Nothing + LinkAnnexFailed -> liftIO $ do writePointerFile tmp k destmode + return Nothing + liftIO $ print ic + maybe noop (restagePointerFile (Restage True) f) ic diff --git a/CHANGELOG b/CHANGELOG index 5a6c05cf89..a3978dc36e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,8 @@ git-annex (7.20181206) UNRELEASED; urgency=medium * webdav: When initializing, avoid trying to make a directory at the top of the webdav server, which could never accomplish anything and failed on nextcloud servers. (Reversion introduced in version 6.20170925.) + * Fix a case where upgrade to v7 caused git to think that unlocked files + were modified. -- Joey Hess Thu, 06 Dec 2018 13:39:16 -0400 diff --git a/doc/forum/why_are_all_those_files_modified/comment_5_ade6edafc859f53845fef5ba0c92fb1b._comment b/doc/forum/why_are_all_those_files_modified/comment_5_ade6edafc859f53845fef5ba0c92fb1b._comment new file mode 100644 index 0000000000..7c4ef13055 --- /dev/null +++ b/doc/forum/why_are_all_those_files_modified/comment_5_ade6edafc859f53845fef5ba0c92fb1b._comment @@ -0,0 +1,7 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 5""" + date="2018-12-11T17:03:38Z" + content=""" +Fixed the problem I described. +"""]]