All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Ben Boeckel" <mathstuf@gmail.com>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Heba Waly" <heba.waly@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 3/5] advice.[ch]: remove advice.pushNonFastForward alias
Date: Mon,  4 Oct 2021 03:58:22 +0200	[thread overview]
Message-ID: <patch-3.5-00eaaeccbcb-20211004T015432Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-0.5-00000000000-20211004T015432Z-avarab@gmail.com>

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@gmail.com>
---
 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


  parent reply	other threads:[~2021-10-04  1:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04  1:58 [PATCH 0/5] advice API: simplification, small fixes, readability Ævar Arnfjörð Bjarmason
2021-10-04  1:58 ` [PATCH 1/5] advice.h: don't indent top-level enum Ævar Arnfjörð Bjarmason
2021-10-04  1:58 ` [PATCH 2/5] advice output: emit empty lines as "hint:", not "hint: " Ævar Arnfjörð Bjarmason
2021-10-04  1:58 ` Ævar Arnfjörð Bjarmason [this message]
2021-10-04  1:58 ` [PATCH 4/5] advice API: revamp the API, again Ævar Arnfjörð Bjarmason
2021-10-04  1:58 ` [PATCH 5/5] advice.[ch]: sort enum fields in alphabetical order Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=patch-3.5-00eaaeccbcb-20211004T015432Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=heba.waly@gmail.com \
    --cc=mathstuf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.