diff options
author | Chris Rorvick <chris@rorvick.com> | 2012-11-29 19:41:34 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-12-02 01:39:50 -0800 |
commit | b24e6047a8da3cddfd686e6a9157ed4bac28ed4f (patch) | |
tree | 6cb17f7ea002a44c823a5c034f5cb856249afe81 /builtin | |
parent | push: return reject reasons as a bitset (diff) | |
download | tgif-b24e6047a8da3cddfd686e6a9157ed4bac28ed4f.tar.xz |
push: add advice for rejected tag reference
Advising the user to fetch and merge only makes sense if the rejected
reference is a branch. If none of the rejections are for branches, just
tell the user the reference already exists.
Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/push.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/builtin/push.c b/builtin/push.c index 9d17fc799c..e08485d123 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -220,6 +220,10 @@ static const char message_advice_checkout_pull_push[] = "(e.g. 'git pull') before pushing again.\n" "See the 'Note about fast-forwards' in 'git push --help' for details."); +static const char message_advice_ref_already_exists[] = + N_("Updates were rejected because the destination reference already exists\n" + "in the remote and the update is not a fast-forward."); + static void advise_pull_before_push(void) { if (!advice_push_non_ff_current || !advice_push_nonfastforward) @@ -241,6 +245,11 @@ static void advise_checkout_pull_push(void) advise(_(message_advice_checkout_pull_push)); } +static void advise_ref_already_exists(void) +{ + advise(_(message_advice_ref_already_exists)); +} + static int push_with_options(struct transport *transport, int flags) { int err; @@ -272,6 +281,8 @@ static int push_with_options(struct transport *transport, int flags) advise_use_upstream(); else advise_checkout_pull_push(); + } else if (reject_reasons & REJECT_ALREADY_EXISTS) { + advise_ref_already_exists(); } return 1; |