git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Add config variable besides env variable to squelch "do-not-use" warning.
@ 2021-06-15 19:38 Daniel Höpfl via GitGitGadget
  2021-06-16  4:23 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Höpfl via GitGitGadget @ 2021-06-15 19:38 UTC (permalink / raw)
  To: git; +Cc: Daniel Höpfl, Daniel Höpfl

From: =?UTF-8?q?Daniel=20H=C3=B6pfl?= <daniel@hoepfl.de>

In addition to the environment variable FILTER_BRANCH_SQUELCH_WARNING,
the git config filter-branch.squelchWarning is checked to see if the
usage warning should be squelched.

Signed-off-by: Daniel Höpfl <daniel@hoepfl.de>
---
    Add filter-branch.squelchWarning git config alongside
    FILTER_BRANCH_SQUELCH_WARNING
    
    In addition to the environment variable FILTER_BRANCH_SQUELCH_WARNING,
    the git config filter-branch.squelchWarning is checked to see if the
    usage warning should be squelched.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-912%2Fdhoepfl%2FFILTER_BRANCH_SQUELCH_WARNING-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-912/dhoepfl/FILTER_BRANCH_SQUELCH_WARNING-v1
Pull-Request: https://github.com/git/git/pull/912

 git-filter-branch.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index fea796461721..d33db14a2a84 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -83,7 +83,8 @@ set_ident () {
 	finish_ident COMMITTER
 }
 
-if test -z "$FILTER_BRANCH_SQUELCH_WARNING$GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS"
+if test -z "$FILTER_BRANCH_SQUELCH_WARNING$GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS" &&
+   test "$(git config --bool filter-branch.squelchWarning)" != true
 then
 	cat <<EOF
 WARNING: git-filter-branch has a glut of gotchas generating mangled history
@@ -91,7 +92,12 @@ WARNING: git-filter-branch has a glut of gotchas generating mangled history
 	 alternative filtering tool such as 'git filter-repo'
 	 (https://github.com/newren/git-filter-repo/) instead.  See the
 	 filter-branch manual page for more details; to squelch this warning,
-	 set FILTER_BRANCH_SQUELCH_WARNING=1.
+	 set FILTER_BRANCH_SQUELCH_WARNING=1 or run the following command:
+
+	    git config filter-branch.squelchWarning true
+
+	 You can replace "git config" with "git config --global" to disable
+	 the warning for all repositories.
 EOF
 	sleep 10
 	printf "Proceeding with filter-branch...\n\n"

base-commit: e4d83eee9239207622e2b1cc43967da5051c189c
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add config variable besides env variable to squelch "do-not-use" warning.
  2021-06-15 19:38 [PATCH] Add config variable besides env variable to squelch "do-not-use" warning Daniel Höpfl via GitGitGadget
@ 2021-06-16  4:23 ` Junio C Hamano
  2021-06-16  8:03   ` Elijah Newren
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2021-06-16  4:23 UTC (permalink / raw)
  To: Daniel Höpfl via GitGitGadget
  Cc: git, Elijah Newren, Daniel Höpfl, Daniel Höpfl

"Daniel Höpfl via GitGitGadget"  <gitgitgadget@gmail.com> writes:

> From: =?UTF-8?q?Daniel=20H=C3=B6pfl?= <daniel@hoepfl.de>
>
> In addition to the environment variable FILTER_BRANCH_SQUELCH_WARNING,
> the git config filter-branch.squelchWarning is checked to see if the
> usage warning should be squelched.

Thanks for trying to improve the system.

A configuration variable that is used to squelch warning messages
related to migration and transition typically lives under advice.*
hierarchy, so something ike "advice.weanOffOfFilterBranch" may be a
more appropriate name for this new knob.

Having said that.

As this message with environment as an escape hatch was added as a
way to strongly discourage users from keep using the command, I am
fairly negative to a change that adds yet another way to make it
easier to keep using it.

Elijah, who did 9df53c5d (Recommend git-filter-repo instead of
git-filter-branch, 2019-09-04), added to CC list for input.

Thanks.

> Signed-off-by: Daniel Höpfl <daniel@hoepfl.de>
> ---
>     Add filter-branch.squelchWarning git config alongside
>     FILTER_BRANCH_SQUELCH_WARNING
>     
>     In addition to the environment variable FILTER_BRANCH_SQUELCH_WARNING,
>     the git config filter-branch.squelchWarning is checked to see if the
>     usage warning should be squelched.
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-912%2Fdhoepfl%2FFILTER_BRANCH_SQUELCH_WARNING-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-912/dhoepfl/FILTER_BRANCH_SQUELCH_WARNING-v1
> Pull-Request: https://github.com/git/git/pull/912
>
>  git-filter-branch.sh | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/git-filter-branch.sh b/git-filter-branch.sh
> index fea796461721..d33db14a2a84 100755
> --- a/git-filter-branch.sh
> +++ b/git-filter-branch.sh
> @@ -83,7 +83,8 @@ set_ident () {
>  	finish_ident COMMITTER
>  }
>  
> -if test -z "$FILTER_BRANCH_SQUELCH_WARNING$GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS"
> +if test -z "$FILTER_BRANCH_SQUELCH_WARNING$GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS" &&
> +   test "$(git config --bool filter-branch.squelchWarning)" != true
>  then
>  	cat <<EOF
>  WARNING: git-filter-branch has a glut of gotchas generating mangled history
> @@ -91,7 +92,12 @@ WARNING: git-filter-branch has a glut of gotchas generating mangled history
>  	 alternative filtering tool such as 'git filter-repo'
>  	 (https://github.com/newren/git-filter-repo/) instead.  See the
>  	 filter-branch manual page for more details; to squelch this warning,
> -	 set FILTER_BRANCH_SQUELCH_WARNING=1.
> +	 set FILTER_BRANCH_SQUELCH_WARNING=1 or run the following command:
> +
> +	    git config filter-branch.squelchWarning true
> +
> +	 You can replace "git config" with "git config --global" to disable
> +	 the warning for all repositories.
>  EOF
>  	sleep 10
>  	printf "Proceeding with filter-branch...\n\n"
>
> base-commit: e4d83eee9239207622e2b1cc43967da5051c189c

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add config variable besides env variable to squelch "do-not-use" warning.
  2021-06-16  4:23 ` Junio C Hamano
@ 2021-06-16  8:03   ` Elijah Newren
  0 siblings, 0 replies; 3+ messages in thread
From: Elijah Newren @ 2021-06-16  8:03 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Daniel Höpfl via GitGitGadget, Git Mailing List,
	Daniel Höpfl, Daniel Höpfl

On Tue, Jun 15, 2021 at 9:23 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Daniel Höpfl via GitGitGadget"  <gitgitgadget@gmail.com> writes:
>
> > From: =?UTF-8?q?Daniel=20H=C3=B6pfl?= <daniel@hoepfl.de>
> >
> > In addition to the environment variable FILTER_BRANCH_SQUELCH_WARNING,
> > the git config filter-branch.squelchWarning is checked to see if the
> > usage warning should be squelched.
>
> Thanks for trying to improve the system.
>
> A configuration variable that is used to squelch warning messages
> related to migration and transition typically lives under advice.*
> hierarchy, so something ike "advice.weanOffOfFilterBranch" may be a
> more appropriate name for this new knob.
>
> Having said that.
>
> As this message with environment as an escape hatch was added as a
> way to strongly discourage users from keep using the command, I am
> fairly negative to a change that adds yet another way to make it
> easier to keep using it.
>
> Elijah, who did 9df53c5d (Recommend git-filter-repo instead of
> git-filter-branch, 2019-09-04), added to CC list for input.

Yeah, I generally would like to discourage it but...

Back when we put this strong discouragement and escape hatch in, I
wasn't aware of anything that could be done in filter-branch that was
hard to do in filter-repo.  However, since then, a user reported they
wanted to re-sign commits after a rewrite.  Since fast-import does not
(currently) provide a way to sign commits, and filter-repo is built on
top of fast-export and fast-import, this makes it rather difficult for
filter-repo to do.  (I think it still can, given all the shenanigans I
did to create filter-branch-ish as a rewrite of filter-branch on top
of filter-repo, but that comes with nearly all the same caveats as
filter-branch if used directly, and is a huge amount of code to lift
to try to use outside of filter-branch-ish.)

Since there's a valid use for filter-branch (even if rare) that isn't
readily done in filter-repo, adding the option Daniel requests makes
sense.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-16  8:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 19:38 [PATCH] Add config variable besides env variable to squelch "do-not-use" warning Daniel Höpfl via GitGitGadget
2021-06-16  4:23 ` Junio C Hamano
2021-06-16  8:03   ` Elijah Newren

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).