[PATCH 3/5] advice.[ch]: remove advice.pushNonFastForward alias

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The advice.pushNonFastForward variable has been primarily known as
advice.pushUpdateRejected since 1184564eac8 (push: rename config
variable for more general use, 2012-12-02). It's been long enough by
far that we can declare this deprecation period over and remove it.

The only downside for users is going to be that they'll potentially
see a more verbose warning that they'll have to re-squash by changing
their config, but that's hardly an undue burden.

Doing this allows us to simplify the advice_enabled() function down to
something truly trivial.

Change the only in-tree user of this, it was added in
fd47d7b94db (git-remote-mediawiki: obey advice.pushNonFastForward,
2011-09-27), and not renamed in 1184564eac8 along with the rest.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 advice.c                                    | 12 +-----------
 advice.h                                    |  1 -
 contrib/mw-to-git/git-remote-mediawiki.perl |  2 +-
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/advice.c b/advice.c
index 9691c7e7899..b395bc7d187 100644
--- a/advice.c
+++ b/advice.c
@@ -52,10 +52,6 @@ static struct {
 	[ADVICE_PUSH_FETCH_FIRST]			= { "pushFetchFirst", 1 },
 	[ADVICE_PUSH_NEEDS_FORCE]			= { "pushNeedsForce", 1 },
 	[ADVICE_PUSH_REF_NEEDS_UPDATE]			= { "pushRefNeedsUpdate", 1 },
-
-	/* make this an alias for backward compatibility */
-	[ADVICE_PUSH_UPDATE_REJECTED_ALIAS]		= { "pushNonFastForward", 1 },
-
 	[ADVICE_PUSH_NON_FF_CURRENT]			= { "pushNonFFCurrent", 1 },
 	[ADVICE_PUSH_NON_FF_MATCHING]			= { "pushNonFFMatching", 1 },
 	[ADVICE_PUSH_UNQUALIFIED_REF_NAME]		= { "pushUnqualifiedRefName", 1 },
@@ -116,13 +112,7 @@ void advise(const char *advice, ...)
 
 int advice_enabled(enum advice_type type)
 {
-	switch(type) {
-	case ADVICE_PUSH_UPDATE_REJECTED:
-		return advice_setting[ADVICE_PUSH_UPDATE_REJECTED].enabled &&
-		       advice_setting[ADVICE_PUSH_UPDATE_REJECTED_ALIAS].enabled;
-	default:
-		return advice_setting[type].enabled;
-	}
+	return advice_setting[type].enabled;
 }
 
 void advise_if_enabled(enum advice_type type, const char *advice, ...)
diff --git a/advice.h b/advice.h
index 694219f5cb2..ab25c6ba9a0 100644
--- a/advice.h
+++ b/advice.h
@@ -32,7 +32,6 @@ enum advice_type {
 	ADVICE_PUSH_NON_FF_CURRENT,
 	ADVICE_PUSH_NON_FF_MATCHING,
 	ADVICE_PUSH_UNQUALIFIED_REF_NAME,
-	ADVICE_PUSH_UPDATE_REJECTED_ALIAS,
 	ADVICE_PUSH_UPDATE_REJECTED,
 	ADVICE_PUSH_REF_NEEDS_UPDATE,
 	ADVICE_RESET_QUIET_WARNING,
diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index a5624413dc1..158e89e5048 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -983,7 +983,7 @@ sub mw_import_revids {
 }
 
 sub error_non_fast_forward {
-	my $advice = run_git_quoted(["config", "--bool", "advice.pushNonFastForward"]);
+	my $advice = run_git_quoted(["config", "--bool", "advice.pushUpdateRejected"]);
 	chomp($advice);
 	if ($advice ne 'false') {
 		# Native git-push would show this after the summary.
-- 
2.33.0.1404.g7bcfc82b295




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux