fix breakage caused by recent commit

34a535ebea 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 2e9341a47d -- 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.
This commit is contained in:
Joey Hess 2021-01-25 21:19:07 -04:00
parent 03b0b61018
commit d4aac64282
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -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