summaryrefslogtreecommitdiff
path: root/builtin/push.c
diff options
context:
space:
mode:
authorChris Rorvick <chris@rorvick.com>2012-11-29 19:41:33 -0600
committerJunio C Hamano <gitster@pobox.com>2012-12-02 01:37:20 -0800
commit10643d4ec3b9c5898d93d1c20e98b2ff1906bf79 (patch)
treea0ce129a944ff6a088807e0bc4d5de5b4838dab7 /builtin/push.c
parentb0b00a3ee43b4813eb85728a482500f6422499fd (diff)
downloadgit-10643d4ec3b9c5898d93d1c20e98b2ff1906bf79.tar.gz
push: return reject reasons as a bitset
Pass all rejection reasons back from transport_push(). The logic is simpler and more flexible with regard to providing useful feedback. Signed-off-by: Chris Rorvick <chris@rorvick.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/push.c')
-rw-r--r--builtin/push.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/builtin/push.c b/builtin/push.c
index db9ba30b08..9d17fc799c 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -244,7 +244,7 @@ static void advise_checkout_pull_push(void)
static int push_with_options(struct transport *transport, int flags)
{
int err;
- int nonfastforward;
+ unsigned int reject_reasons;
transport_set_verbosity(transport, verbosity, progress);
@@ -257,7 +257,7 @@ static int push_with_options(struct transport *transport, int flags)
if (verbosity > 0)
fprintf(stderr, _("Pushing to %s\n"), transport->url);
err = transport_push(transport, refspec_nr, refspec, flags,
- &nonfastforward);
+ &reject_reasons);
if (err != 0)
error(_("failed to push some refs to '%s'"), transport->url);
@@ -265,18 +265,13 @@ static int push_with_options(struct transport *transport, int flags)
if (!err)
return 0;
- switch (nonfastforward) {
- default:
- break;
- case NON_FF_HEAD:
+ if (reject_reasons & REJECT_NON_FF_HEAD) {
advise_pull_before_push();
- break;
- case NON_FF_OTHER:
+ } else if (reject_reasons & REJECT_NON_FF_OTHER) {
if (default_matching_used)
advise_use_upstream();
else
advise_checkout_pull_push();
- break;
}
return 1;