Skip to content

Commit

Permalink
push: rename config variable for more general use
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chris Rorvick authored and Junio C Hamano committed Dec 3, 2012
1 parent a272b28 commit 1184564
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ advice.*::
can tell Git that you do not need help by setting these to 'false':
+
--
pushNonFastForward::
pushUpdateRejected::
Set this variable to 'false' if you want to disable
'pushNonFFCurrent', 'pushNonFFDefault', and
'pushNonFFMatching' simultaneously.
Expand Down
7 changes: 5 additions & 2 deletions advice.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "cache.h"

int advice_push_nonfastforward = 1;
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;
Expand All @@ -14,7 +14,7 @@ static struct {
const char *name;
int *preference;
} advice_config[] = {
{ "pushnonfastforward", &advice_push_nonfastforward },
{ "pushupdaterejected", &advice_push_update_rejected },
{ "pushnonffcurrent", &advice_push_non_ff_current },
{ "pushnonffdefault", &advice_push_non_ff_default },
{ "pushnonffmatching", &advice_push_non_ff_matching },
Expand All @@ -23,6 +23,9 @@ static struct {
{ "resolveconflict", &advice_resolve_conflict },
{ "implicitidentity", &advice_implicit_identity },
{ "detachedhead", &advice_detached_head },

/* make this an alias for backward compatibility */
{ "pushnonfastforward", &advice_push_update_rejected }
};

void advise(const char *advice, ...)
Expand Down
2 changes: 1 addition & 1 deletion advice.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "git-compat-util.h"

extern int advice_push_nonfastforward;
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;
Expand Down
6 changes: 3 additions & 3 deletions builtin/push.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,21 +226,21 @@ static const char message_advice_ref_already_exists[] =

static void advise_pull_before_push(void)
{
if (!advice_push_non_ff_current || !advice_push_nonfastforward)
if (!advice_push_non_ff_current || !advice_push_update_rejected)
return;
advise(_(message_advice_pull_before_push));
}

static void advise_use_upstream(void)
{
if (!advice_push_non_ff_default || !advice_push_nonfastforward)
if (!advice_push_non_ff_default || !advice_push_update_rejected)
return;
advise(_(message_advice_use_upstream));
}

static void advise_checkout_pull_push(void)
{
if (!advice_push_non_ff_matching || !advice_push_nonfastforward)
if (!advice_push_non_ff_matching || !advice_push_update_rejected)
return;
advise(_(message_advice_checkout_pull_push));
}
Expand Down

0 comments on commit 1184564

Please sign in to comment.