add gitAnnexChildProcess and use instead of incorrect use of runsGitAnnexChildProcess

Fixes reversion in 8.20200617 that made annex.pidlock being enabled result
in some commands stalling, particularly those needing to autoinit.

Renamed runsGitAnnexChildProcess to make clearer where it should be
used.

Arguably, it would be better to have a way to make any process git-annex
runs have the env var set. But then it would need to take the pid lock
when running any and all processes, and that would be a problem when
git-annex runs two processes concurrently. So, I'm left doing it ad-hoc
in places where git-annex really does run a child process, directly
or indirectly via a particular git command.
This commit is contained in:
Joey Hess 2020-08-25 14:57:25 -04:00
parent 6b0532e532
commit 7bdb0cdc0d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 97 additions and 33 deletions

View file

@ -65,7 +65,6 @@ import Annex.UpdateInstead
import Annex.Export
import Annex.TaggedPush
import Annex.CurrentBranch
import Annex.GitOverlay
import qualified Database.Export as Export
import Utility.Bloom
import Utility.OptParse
@ -515,10 +514,12 @@ pushRemote o remote (Just branch, _) = do
postpushupdate repo = case Git.repoWorkTree repo of
Nothing -> return True
Just wt -> ifM needemulation
( runsGitAnnexChildProcess $ liftIO $ do
p <- programPath
boolSystem' p [Param "post-receive"]
(\cp -> cp { cwd = Just (fromRawFilePath wt) })
( gitAnnexChildProcess ["post-receive"]
(\cp -> cp { cwd = Just (fromRawFilePath wt) })
(\_ _ _ pid -> waitForProcess pid >>= return . \case
ExitSuccess -> True
_ -> False
)
, return True
)
where