diff options
author | Chris Rorvick <chris@rorvick.com> | 2012-11-29 19:41:33 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-12-02 01:37:20 -0800 |
commit | 10643d4ec3b9c5898d93d1c20e98b2ff1906bf79 (patch) | |
tree | a0ce129a944ff6a088807e0bc4d5de5b4838dab7 /builtin/push.c | |
parent | b0b00a3ee43b4813eb85728a482500f6422499fd (diff) | |
download | git-10643d4ec3b9c5898d93d1c20e98b2ff1906bf79.tar.gz git-10643d4ec3b9c5898d93d1c20e98b2ff1906bf79.tar.xz |
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.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/builtin/push.c b/builtin/push.c index db9ba30b0..9d17fc799 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; |