]> git.ipfire.org Git - thirdparty/git.git/commitdiff
push: allow already-exists advice to be disabled
authorChris Rorvick <chris@rorvick.com>
Mon, 3 Dec 2012 03:27:51 +0000 (21:27 -0600)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Dec 2012 16:04:09 +0000 (08:04 -0800)
Add 'advice.pushAlreadyExists' option to disable the advice shown when
an update is rejected for a reference that is not allowed to update at
all (verses those that are allowed to fast-forward.)

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config.txt
advice.c
advice.h
builtin/push.c

index 92903f22d99e70905b5d49026f41ba65ffcd5019..90e7d10baddeecbf11dd09145abab1e5dbd3e7cc 100644 (file)
@@ -142,8 +142,9 @@ advice.*::
 --
        pushUpdateRejected::
                Set this variable to 'false' if you want to disable
-               'pushNonFFCurrent', 'pushNonFFDefault', and
-               'pushNonFFMatching' simultaneously.
+               'pushNonFFCurrent', 'pushNonFFDefault',
+               'pushNonFFMatching', and 'pushAlreadyExists'
+               simultaneously.
        pushNonFFCurrent::
                Advice shown when linkgit:git-push[1] fails due to a
                non-fast-forward update to the current branch.
@@ -158,6 +159,9 @@ advice.*::
                'matching refs' explicitly (i.e. you used ':', or
                specified a refspec that isn't your current branch) and
                it resulted in a non-fast-forward error.
+       pushAlreadyExists::
+               Shown when linkgit:git-push[1] rejects an update that
+               does not qualify for fast-forwarding (e.g., a tag.)
        statusHints::
                Show directions on how to proceed from the current
                state in the output of linkgit:git-status[1] and in
index 329e0773dba8b3988caf4a7796ced1082c9a4c6a..d2879272802cb3477dd6b47a78098ffdc26dcb37 100644 (file)
--- a/advice.c
+++ b/advice.c
@@ -4,6 +4,7 @@ int advice_push_update_rejected = 1;
 int advice_push_non_ff_current = 1;
 int advice_push_non_ff_default = 1;
 int advice_push_non_ff_matching = 1;
+int advice_push_already_exists = 1;
 int advice_status_hints = 1;
 int advice_commit_before_merge = 1;
 int advice_resolve_conflict = 1;
@@ -18,6 +19,7 @@ static struct {
        { "pushnonffcurrent", &advice_push_non_ff_current },
        { "pushnonffdefault", &advice_push_non_ff_default },
        { "pushnonffmatching", &advice_push_non_ff_matching },
+       { "pushalreadyexists", &advice_push_already_exists },
        { "statushints", &advice_status_hints },
        { "commitbeforemerge", &advice_commit_before_merge },
        { "resolveconflict", &advice_resolve_conflict },
index c28ef8ac2319909c9824413b4c94a708ed76f621..8bf63563a5cf1573e0e6bf7ffcd5c55643d3f439 100644 (file)
--- a/advice.h
+++ b/advice.h
@@ -7,6 +7,7 @@ extern int advice_push_update_rejected;
 extern int advice_push_non_ff_current;
 extern int advice_push_non_ff_default;
 extern int advice_push_non_ff_matching;
+extern int advice_push_already_exists;
 extern int advice_status_hints;
 extern int advice_commit_before_merge;
 extern int advice_resolve_conflict;
index cf5ecfaf0402207d440baa76ef4bd1c3fe6b5e81..8491e431e41aaff32c76ab0c61f528682b3babdb 100644 (file)
@@ -247,6 +247,8 @@ static void advise_checkout_pull_push(void)
 
 static void advise_ref_already_exists(void)
 {
+       if (!advice_push_already_exists || !advice_push_update_rejected)
+               return;
        advise(_(message_advice_ref_already_exists));
 }