push: rename config variable for more general use

The 'pushNonFastForward' advice config can be used to squelch several instances of push-related advice. Rename it to 'pushUpdateRejected' to cover other reject scenarios that are unrelated to fast-forwarding. Retain the old name for compatibility. 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 1184564eac8ef6c82da068a31f60aee0d6870265
4 files changed +10 -7
Documentation/config.txt
+1 -1
@@ -140,7 +140,7 @@ advice.*::
140 can tell Git that you do not need help by setting these to 'false':
141 +
142 --
143 - pushNonFastForward::
143 + pushUpdateRejected::
144 Set this variable to 'false' if you want to disable
145 'pushNonFFCurrent', 'pushNonFFDefault', and
146 'pushNonFFMatching' simultaneously.
advice.c
+5 -2
@@ -1,6 +1,6 @@
1 #include "cache.h"
2
3 -int advice_push_nonfastforward = 1;
3 +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;
@@ -14,7 +14,7 @@ static struct {
14 const char *name;
15 int *preference;
16 } advice_config[] = {
17 - { "pushnonfastforward", &advice_push_nonfastforward },
17 + { "pushupdaterejected", &advice_push_update_rejected },
18 { "pushnonffcurrent", &advice_push_non_ff_current },
19 { "pushnonffdefault", &advice_push_non_ff_default },
20 { "pushnonffmatching", &advice_push_non_ff_matching },
@@ -23,6 +23,9 @@ static struct {
23 { "resolveconflict", &advice_resolve_conflict },
24 { "implicitidentity", &advice_implicit_identity },
25 { "detachedhead", &advice_detached_head },
26 +
27 + /* make this an alias for backward compatibility */
28 + { "pushnonfastforward", &advice_push_update_rejected }
29 };
30
31 void advise(const char *advice, ...)
advice.h
+1 -1
@@ -3,7 +3,7 @@
3
4 #include "git-compat-util.h"
5
6 -extern int advice_push_nonfastforward;
6 +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;
builtin/push.c
+3 -3
@@ -226,21 +226,21 @@ static const char message_advice_ref_already_exists[] =
226
227 static void advise_pull_before_push(void)
228 {
229 - if (!advice_push_non_ff_current || !advice_push_nonfastforward)
229 + if (!advice_push_non_ff_current || !advice_push_update_rejected)
230 return;
231 advise(_(message_advice_pull_before_push));
232 }
233
234 static void advise_use_upstream(void)
235 {
236 - if (!advice_push_non_ff_default || !advice_push_nonfastforward)
236 + if (!advice_push_non_ff_default || !advice_push_update_rejected)
237 return;
238 advise(_(message_advice_use_upstream));
239 }
240
241 static void advise_checkout_pull_push(void)
242 {
243 - if (!advice_push_non_ff_matching || !advice_push_nonfastforward)
243 + if (!advice_push_non_ff_matching || !advice_push_update_rejected)
244 return;
245 advise(_(message_advice_checkout_pull_push));
246 }