aboutsummaryrefslogtreecommitdiff
path: root/Annex/Content.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-12-29 16:26:27 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-12-29 16:26:27 -0400
commitfecb9b63b21326836341bcf773d7c4c2d345c11e (patch)
treea934b81debba960bd8446bf25abe57ebf4a7ed6b /Annex/Content.hs
parentbc22a44b2d8ea4edd4e830604acde9de8deb204b (diff)
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.
Diffstat (limited to 'Annex/Content.hs')
-rw-r--r--Annex/Content.hs15
1 files changed, 9 insertions, 6 deletions
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]