Avoid more than 1 gpg password prompt at the same time

Which could happen occasionally before when concurrency is enabled.
While not much of a problem when it did happen, better to avoid it. Also,
since it seems likely the gpg-agent sometimes fails in such a situation,
this makes it not happen when running a single git-annex command with
concurrency enabled.

This commit was sponsored by Jake Vosloo on Patreon.
This commit is contained in:
Joey Hess 2021-04-27 16:36:33 -04:00
parent 42cacb4099
commit 0f73b6d03a
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 42 additions and 14 deletions

View file

@ -122,6 +122,7 @@ data AnnexRead = AnnexRead
, transferrerpool :: TransferrerPool
, debugenabled :: Bool
, debugselector :: DebugSelector
, ciphers :: TMVar (M.Map StorableCipher Cipher)
}
newAnnexRead :: GitConfig -> IO AnnexRead
@ -132,6 +133,7 @@ newAnnexRead c = do
sc <- newTMVarIO False
si <- newTVarIO M.empty
tp <- newTransferrerPool
cm <- newTMVarIO M.empty
return $ AnnexRead
{ activekeys = emptyactivekeys
, activeremotes = emptyactiveremotes
@ -141,6 +143,7 @@ newAnnexRead c = do
, transferrerpool = tp
, debugenabled = annexDebug c
, debugselector = debugSelectorFromGitConfig c
, ciphers = cm
}
-- Values that can change while running an Annex action.
@ -178,7 +181,6 @@ data AnnexState = AnnexState
, forcetrust :: TrustMap
, trustmap :: Maybe TrustMap
, groupmap :: Maybe GroupMap
, ciphers :: M.Map StorableCipher Cipher
, lockcache :: LockCache
, flags :: M.Map String Bool
, fields :: M.Map String String
@ -237,7 +239,6 @@ newAnnexState c r = do
, forcetrust = M.empty
, trustmap = Nothing
, groupmap = Nothing
, ciphers = M.empty
, lockcache = M.empty
, flags = M.empty
, fields = M.empty