fix inode cache consistency bug when a merge unlocks a present file

Since the file was present and locked, its annex object was not in the
inode cache. So, despite not needing to update the annex object when the
clean filter is run on the content by git merge, it does need to record the
inode cache of the annex object. Otherwise, the annex object will be
assumed to be bad, since its inode is not cached.
This commit is contained in:
Joey Hess 2015-12-29 16:26:27 -04:00
parent b6b34f4916
commit 2e9341a47d
Failed to extract signature

View file

@ -544,12 +544,16 @@ data FromTo = From | To
-}
linkAnnex :: FromTo -> Key -> FilePath -> Maybe InodeCache -> FilePath -> Annex LinkAnnexResult
linkAnnex _ _ _ Nothing _ = return LinkAnnexFailed
linkAnnex fromto key src (Just srcic) dest =
ifM (liftIO $ doesFileExist dest)
( do
Database.Keys.addInodeCaches key [srcic]
linkAnnex fromto key src (Just srcic) dest = do
mdestic <- withTSDelta (liftIO . genInodeCache dest)
case mdestic of
Just destic -> do
cs <- Database.Keys.getInodeCaches key
if null cs
then Database.Keys.addInodeCaches key [srcic, destic]
else Database.Keys.addInodeCaches key [srcic]
return LinkAnnexNoop
, ifM (linkOrCopy key src dest)
Nothing -> ifM (linkOrCopy key src dest)
( do
thawContent $ case fromto of
From -> dest
@ -557,7 +561,6 @@ linkAnnex fromto key src (Just srcic) dest =
checksrcunchanged
, failed
)
)
where
failed = do
Database.Keys.addInodeCaches key [srcic]