lock to avoid more than one export to a remote at a time

This commit was sponsored by Jack Hill on Patreon.
This commit is contained in:
Joey Hess 2017-09-18 12:12:11 -04:00
parent af0958dd70
commit 486902389d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 11 additions and 2 deletions

View file

@ -23,6 +23,7 @@ import Types.Remote
import Types.Export
import Annex.Content
import Annex.CatFile
import Annex.LockFile
import Logs.Location
import Logs.Export
import Database.Export
@ -85,7 +86,10 @@ seek o = do
r <- getParsed (exportRemote o)
unlessM (isExportSupported r) $
giveup "That remote does not support exports."
withExclusiveLock (gitAnnexExportLock (uuid r)) (seek' o r)
seek' :: ExportOptions -> Remote -> CommandSeek
seek' o r = do
new <- fromMaybe (giveup "unknown tree") <$>
-- Dereference the tree pointed to by the branch, commit,
-- or tag.