make git-annex:git-annex push quiet again

Recent changes had a side effect of displaying errors in the fairly
common case when this push fails. Since the synced/git-annex push
is always forced, those errors are noise, so hide again.

This means 3 separate pushes are done now, where before it only made 2.
A bit more expensive, but ssh connection caching eliminates most of
the costs.

This commit was sponsored by Boyd Stephen Smith Jr. on Patreon.
This commit is contained in:
Joey Hess 2017-02-17 14:00:01 -04:00
parent de4d50e9d0
commit 4594bece40
No known key found for this signature in database
GPG key ID: C910D9222512E3C7

View file

@ -418,12 +418,14 @@ pushRemote o remote (Just branch, _) = stopUnless (pure (pushOption o) <&&> need
- set on the remote.
-}
pushBranch :: Remote -> Git.Branch -> Git.Repo -> IO Bool
pushBranch remote branch g = directpush `after` syncpush
pushBranch remote branch g = directpush `after` annexpush `after` syncpush
where
syncpush = flip Git.Command.runBool g $ pushparams
[ Git.Branch.forcePush $ refspec Annex.Branch.name
, refspec $ fromAdjustedBranch branch
]
annexpush = void $ tryIO $ flip Git.Command.runQuiet g $ pushparams
[ Git.fromRef $ Git.Ref.base $ Annex.Branch.name ]
directpush = do
-- Git prints out an error message when this fails.
-- In the default configuration of receive.denyCurrentBranch,
@ -436,9 +438,7 @@ pushBranch remote branch g = directpush `after` syncpush
-- receive.denyCurrentBranch=updateInstead -- the user
-- will want to see that one.
let p = flip Git.Command.gitCreateProcess g $ pushparams
[ Git.fromRef $ Git.Ref.base $ Annex.Branch.name
, Git.fromRef $ Git.Ref.base $ fromDirectBranch $ fromAdjustedBranch branch
]
[ Git.fromRef $ Git.Ref.base $ fromDirectBranch $ fromAdjustedBranch branch ]
(transcript, ok) <- processTranscript' p Nothing
when (not ok && not ("denyCurrentBranch" `isInfixOf` transcript)) $
hPutStr stderr transcript