aboutsummaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-02-17 14:00:01 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-02-17 14:03:17 -0400
commit5b64144c2fb989f9799c1ec328b442b504b1d10f (patch)
treeb1092582dba0863c9143d4a65697bda50b65f800 /Command
parentee07d1d35324c40bd15c855676f3f6300dc87a76 (diff)
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.
Diffstat (limited to 'Command')
-rw-r--r--Command/Sync.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index ca6e86271..78a66a14a 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