From fecb9b63b21326836341bcf773d7c4c2d345c11e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 29 Dec 2015 16:26:27 -0400 Subject: 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. --- Annex/Content.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'Annex/Content.hs') diff --git a/Annex/Content.hs b/Annex/Content.hs index 9d3732d0b..be460f068 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -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] -- cgit v1.2.3