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.
This commit is contained in:
parent
8e9608d7f0
commit
4392140946
4 changed files with 39 additions and 17 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue