summaryrefslogtreecommitdiff
path: root/builtin/push.c
diff options
context:
space:
mode:
authorChris Rorvick <chris@rorvick.com>2012-11-29 19:41:34 -0600
committerJunio C Hamano <gitster@pobox.com>2012-12-02 01:39:50 -0800
commitb24e6047a8da3cddfd686e6a9157ed4bac28ed4f (patch)
tree6cb17f7ea002a44c823a5c034f5cb856249afe81 /builtin/push.c
parent10643d4ec3b9c5898d93d1c20e98b2ff1906bf79 (diff)
downloadgit-b24e6047a8da3cddfd686e6a9157ed4bac28ed4f.tar.gz
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/push.c')
-rw-r--r--builtin/push.c11
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;