summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--builtin-push.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin-push.c b/builtin-push.c
index 9846c638a6..03be045bae 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -102,13 +102,14 @@ static int push_with_options(struct transport *transport, int flags)
fprintf(stderr, "Pushing to %s\n", transport->url);
err = transport_push(transport, refspec_nr, refspec, flags,
&nonfastforward);
+ if (err != 0)
+ error("failed to push some refs to '%s'", transport->url);
+
err |= transport_disconnect(transport);
if (!err)
return 0;
- error("failed to push some refs to '%s'", transport->url);
-
if (nonfastforward && advice_push_nonfastforward) {
printf("To prevent you from losing history, non-fast-forward updates were rejected\n"
"Merge the remote changes before pushing again. See the 'non-fast-forward'\n"