avoid ingest lockdown file escaping the withOtherTmp call

Fixes bug that caused git-annex to fail to add a file when another
git-annex process cleaned up the temp directory it was using.

Solution is just to push withOtherTmp out to a higher level, so that
the whole ingest process can be completed inside it.

But in the assistant, that was not practical to do, since withOtherTmp runs
in the Annex monad and the assistant does not. Worked around by introducing
a separate temp directory that only the assistant uses for lockdown.
Since only one assistant can run at a time, it's easy to clean up that
directory of old cruft at startup.
This commit is contained in:
Joey Hess 2019-05-07 13:04:39 -04:00
parent 2a41712ef1
commit 2d33122215
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
8 changed files with 60 additions and 35 deletions

View file

@ -19,6 +19,7 @@ import Config
import Annex.FileMatcher
import Annex.Link
import Annex.Version
import Annex.Tmp
import Git.FilePath
cmd :: Command
@ -137,11 +138,11 @@ start file = do
next $ next $ addFile file
perform :: FilePath -> CommandPerform
perform file = do
perform file = withOtherTmp $ \tmpdir -> do
lockingfile <- not <$> addUnlocked
let cfg = LockDownConfig
{ lockingFile = lockingfile
, hardlinkFileTmp = True
, hardlinkFileTmpDir = Just tmpdir
}
lockDown cfg file >>= ingestAdd >>= finish
where