From 4594bece407c18f4f1b96ea7c20d85c42ce3072c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Feb 2017 14:00:01 -0400 Subject: [PATCH] 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. --- Command/Sync.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Command/Sync.hs b/Command/Sync.hs index ca6e86271c..78a66a14ab 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -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