From d4aac6428221f9069da85181ed37163bd8f11d58 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 25 Jan 2021 21:19:07 -0400 Subject: [PATCH] fix breakage caused by recent commit 34a535ebeaf483f6643f949ae774939650d74837 broke the test suite. Getting a file started failing in one case, because the annex object did not have its inode cached, so was not trusted to be unmodified. This adds something very similar to what was added to linkAnnex in commit 2e9341a47d437b5a7b14824d3e5b2864b059a850 -- if there are not yet any inodes cached for a key, add the inode of the annex object when adding the inode of the unlocked file. Feels like this should be handled in a more principled way. How do we know the addInodeCaches call in getMoveRaceRecovery just above this change is currently correct? It doesn't add the annex object inode cache. Ah well, maybe sometime when I've not had my entire evening eaten by a reversion that the test suite caught as I was cooking dinner. --- Command/Smudge.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Command/Smudge.hs b/Command/Smudge.hs index a092b6ad68..907958a15f 100644 --- a/Command/Smudge.hs +++ b/Command/Smudge.hs @@ -259,8 +259,13 @@ updateSmudged restage = streamSmudged $ \k topf -> do f <- fromRepo (fromTopFilePath topf) whenM (inAnnex k) $ do obj <- calcRepo (gitAnnexLocation k) + objic <- withTSDelta (liftIO . genInodeCache obj) populatePointerFile restage k obj f >>= \case - Just ic -> Database.Keys.addInodeCaches k [ic] + Just ic -> do + cs <- Database.Keys.getInodeCaches k + if null cs + then Database.Keys.addInodeCaches k (catMaybes [Just ic, objic]) + else Database.Keys.addInodeCaches k [ic] Nothing -> liftIO (isPointerFile f) >>= \case Just k' | k' == k -> toplevelWarning False $ "unable to populate worktree file " ++ fromRawFilePath f