diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-12-22 15:20:03 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-12-22 15:20:03 -0400 |
commit | 00e240f3803384ae8761f2d5bc95319351f4e0fa (patch) | |
tree | 67a9639c72a8bd8239abb377d77962f4ba9c2a5a /Command/Unlock.hs | |
parent | 0da2a837d1634164695591029072b88cd56b46e7 (diff) |
make linkAnnex detect when the file changes as it's being copied/linked in
This fixes a race where the modified file ended up in annex/objects, and
the InodeCache stored in the database was for the modified version, so
git-annex didn't know it had gotten modified.
The race could occur when the smudge filter was running; now it gets the
InodeCache before generating the Key, which avoids the race.
Diffstat (limited to 'Command/Unlock.hs')
-rw-r--r-- | Command/Unlock.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Command/Unlock.hs b/Command/Unlock.hs index 1cfd4a0b2..b82f78096 100644 --- a/Command/Unlock.hs +++ b/Command/Unlock.hs @@ -14,6 +14,8 @@ import Annex.CatFile import Annex.Version import Annex.Link import Annex.ReplaceFile +import Annex.InodeSentinal +import Utility.InodeCache import Utility.CopyFile cmd :: Command @@ -51,8 +53,9 @@ start file key = ifM (isJust <$> isAnnexLink file) performNew :: FilePath -> Key -> CommandPerform performNew dest key = do src <- calcRepo (gitAnnexLocation key) + srcic <- withTSDelta (liftIO . genInodeCache src) replaceFile dest $ \tmp -> do - r <- linkAnnex' key src tmp + r <- linkAnnex' key src srcic tmp case r of LinkAnnexOk -> return () _ -> error "linkAnnex failed" |