push: allow already-exists advice to be disabled
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>
Chris Rorvick committed
Dec 2, 2012 at 21:27 UTC
b450568209c8ae270d26ee7fda2e4687ad8a5327
4 files changed
+11
-2
Documentation/config.txt
+6
-2
@@ -142,8 +142,9 @@ advice.*::
142
--
143
pushUpdateRejected::
144
Set this variable to 'false' if you want to disable
145
- 'pushNonFFCurrent', 'pushNonFFDefault', and
146
- 'pushNonFFMatching' simultaneously.
145
+ 'pushNonFFCurrent', 'pushNonFFDefault',
146
+ 'pushNonFFMatching', and 'pushAlreadyExists'
147
+ simultaneously.
148
pushNonFFCurrent::
149
Advice shown when linkgit:git-push[1] fails due to a
150
non-fast-forward update to the current branch.
@@ -158,6 +159,9 @@ advice.*::
159
'matching refs' explicitly (i.e. you used ':', or
160
specified a refspec that isn't your current branch) and
161
it resulted in a non-fast-forward error.
162
+ pushAlreadyExists::
163
+ Shown when linkgit:git-push[1] rejects an update that
164
+ does not qualify for fast-forwarding (e.g., a tag.)
165
statusHints::
166
Show directions on how to proceed from the current
167
state in the output of linkgit:git-status[1] and in
advice.c
+2
@@ -4,6 +4,7 @@ int advice_push_update_rejected = 1;
4
int advice_push_non_ff_current = 1;
5
int advice_push_non_ff_default = 1;
6
int advice_push_non_ff_matching = 1;
7
+int advice_push_already_exists = 1;
8
int advice_status_hints = 1;
9
int advice_commit_before_merge = 1;
10
int advice_resolve_conflict = 1;
@@ -18,6 +19,7 @@ static struct {
19
{ "pushnonffcurrent", &advice_push_non_ff_current },
20
{ "pushnonffdefault", &advice_push_non_ff_default },
21
{ "pushnonffmatching", &advice_push_non_ff_matching },
22
+ { "pushalreadyexists", &advice_push_already_exists },
23
{ "statushints", &advice_status_hints },
24
{ "commitbeforemerge", &advice_commit_before_merge },
25
{ "resolveconflict", &advice_resolve_conflict },
advice.h
+1
@@ -7,6 +7,7 @@ extern int advice_push_update_rejected;
7
extern int advice_push_non_ff_current;
8
extern int advice_push_non_ff_default;
9
extern int advice_push_non_ff_matching;
10
+extern int advice_push_already_exists;
11
extern int advice_status_hints;
12
extern int advice_commit_before_merge;
13
extern int advice_resolve_conflict;
builtin/push.c
+2
@@ -247,6 +247,8 @@ static void advise_checkout_pull_push(void)
247
248
static void advise_ref_already_exists(void)
249
{
250
+ if (!advice_push_already_exists || !advice_push_update_rejected)
251
+ return;
252
advise(_(message_advice_ref_already_exists));
253
}
254