git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Suppressing filter-branch warning
@ 2020-11-06  9:04 Daniel Höpfl
  2020-11-06 18:06 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Höpfl @ 2020-11-06  9:04 UTC (permalink / raw)
  To: git

Hello there,

What did you do before the bug happened? (Steps to reproduce your issue)
git filter-branch -f --env-filter '' --tag-name-filter cat -- HEAD

What did you expect to happen? (Expected behavior)
See below (difference).

What happened instead? (Actual behavior)
When using git filter-branch, the following message is shown:

----------8<-----------------------------------------------------
WARNING: git-filter-branch has a glut of gotchas generating mangled history
         rewrites.  Hit Ctrl-C before proceeding to abort, then use an
         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.
----------8<-----------------------------------------------------

You can suppress this by setting the environment variable shown.

What's different between what you expected and what actually happened?

Normally, when git introduces this kind of change, there is a
git config variable that one can set to suppress it.
That way one has fine grade control when to suppress it (one repo only...globally).

Anything else you want to add:

-/-

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.29.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64
compiler info: gnuc: 8.3
libc info: glibc: 2.28
$SHELL (typically, interactive shell): /bin/bash


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

* Re: Suppressing filter-branch warning
  2020-11-06  9:04 Suppressing filter-branch warning Daniel Höpfl
@ 2020-11-06 18:06 ` Junio C Hamano
  2020-11-06 20:12   ` Elijah Newren
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2020-11-06 18:06 UTC (permalink / raw)
  To: Elijah Newren; +Cc: git, Daniel Höpfl

Daniel Höpfl <daniel@hoepfl.de> writes:

> Hello there,
>
> What did you do before the bug happened? (Steps to reproduce your issue)
> git filter-branch -f --env-filter '' --tag-name-filter cat -- HEAD
>
> What did you expect to happen? (Expected behavior)
> See below (difference).
>
> What happened instead? (Actual behavior)
> When using git filter-branch, the following message is shown:
>
> ----------8<-----------------------------------------------------
> WARNING: git-filter-branch has a glut of gotchas generating mangled history
>         rewrites.  Hit Ctrl-C before proceeding to abort, then use an
>         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.
> ----------8<-----------------------------------------------------
>
> You can suppress this by setting the environment variable shown.
>
> What's different between what you expected and what actually happened?
>
> Normally, when git introduces this kind of change, there is a
> git config variable that one can set to suppress it.
> That way one has fine grade control when to suppress it (one repo only...globally).

I think this comes from 9df53c5d (Recommend git-filter-repo instead
of git-filter-branch, 2019-09-04).  

FWIW, I personally do not think an environment is a worse choice
over configuration variable in this particular case.  The large
scale rewriting of the entire history in the repository by its
nature is an one-off operation that ought to happen only rarely,
so a one-shot

	$ FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch ...

that reminds the user every time would be more appropriate than a
configuration variable that has a more permanent squelching effect.

If it were a new command line option may have been even better, as
an environment variable can be defined in .*rc and forgotten, but a
command line option needs to be typed every time and would serve as
a better reminder (yes, I know it can also be aliased away, so it
may not make much practical difference either way).

But I'll let the author of the feature to comment.

Thanks.

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

* Re: Suppressing filter-branch warning
  2020-11-06 18:06 ` Junio C Hamano
@ 2020-11-06 20:12   ` Elijah Newren
  2020-11-10 11:21     ` Daniel Höpfl
  0 siblings, 1 reply; 5+ messages in thread
From: Elijah Newren @ 2020-11-06 20:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List, Daniel Höpfl

On Fri, Nov 6, 2020 at 10:06 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> Daniel Höpfl <daniel@hoepfl.de> writes:
>
> > Hello there,
> >
> > What did you do before the bug happened? (Steps to reproduce your issue)
> > git filter-branch -f --env-filter '' --tag-name-filter cat -- HEAD
> >
> > What did you expect to happen? (Expected behavior)
> > See below (difference).
> >
> > What happened instead? (Actual behavior)
> > When using git filter-branch, the following message is shown:
> >
> > ----------8<-----------------------------------------------------
> > WARNING: git-filter-branch has a glut of gotchas generating mangled history
> >         rewrites.  Hit Ctrl-C before proceeding to abort, then use an
> >         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.
> > ----------8<-----------------------------------------------------
> >
> > You can suppress this by setting the environment variable shown.
> >
> > What's different between what you expected and what actually happened?
> >
> > Normally, when git introduces this kind of change, there is a
> > git config variable that one can set to suppress it.
> > That way one has fine grade control when to suppress it (one repo only...globally).
>
> I think this comes from 9df53c5d (Recommend git-filter-repo instead
> of git-filter-branch, 2019-09-04).
>
> FWIW, I personally do not think an environment is a worse choice
> over configuration variable in this particular case.  The large
> scale rewriting of the entire history in the repository by its
> nature is an one-off operation that ought to happen only rarely,
> so a one-shot
>
>         $ FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch ...
>
> that reminds the user every time would be more appropriate than a
> configuration variable that has a more permanent squelching effect.
>
> If it were a new command line option may have been even better, as
> an environment variable can be defined in .*rc and forgotten, but a
> command line option needs to be typed every time and would serve as
> a better reminder (yes, I know it can also be aliased away, so it
> may not make much practical difference either way).
>
> But I'll let the author of the feature to comment.
>
> Thanks.

I agree with Junio that filter-branch's one-off nature means that not
providing a configuration variable seems reasonable in this case.  If
someone else were to go to the effort of implementing some
configuration option here, I wouldn't be that strongly against it,
though I'd rather just let filter-branch lie dormant and stable.

A new command line option might have been better, but it didn't occur
to me at the time this change was made and I hesitate to needlessly
force people to adapt again.

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

* Re: Suppressing filter-branch warning
  2020-11-06 20:12   ` Elijah Newren
@ 2020-11-10 11:21     ` Daniel Höpfl
  2020-11-10 12:15       ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Höpfl @ 2020-11-10 11:21 UTC (permalink / raw)
  To: Elijah Newren; +Cc: Junio C Hamano, Git Mailing List

Hallo Elijah,

On Fri, Nov 06, 2020 at 12:12:55PM -0800, Elijah Newren wrote:
>On Fri, Nov 6, 2020 at 10:06 AM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> Daniel Höpfl <daniel@hoepfl.de> writes:
>>
>> > Hello there,
>> >
>> > What did you do before the bug happened? (Steps to reproduce your issue)
>> > git filter-branch -f --env-filter '' --tag-name-filter cat -- HEAD
>> >
>> > What did you expect to happen? (Expected behavior)
>> > See below (difference).
>> >
>> > What happened instead? (Actual behavior)
>> > When using git filter-branch, the following message is shown:
>> >
>> > ----------8<-----------------------------------------------------
>> > WARNING: git-filter-branch has a glut of gotchas generating mangled history
>> >         rewrites.  Hit Ctrl-C before proceeding to abort, then use an
>> >         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.
>> > ----------8<-----------------------------------------------------
>> >
>> > You can suppress this by setting the environment variable shown.
>> >
>> > What's different between what you expected and what actually happened?
>> >
>> > Normally, when git introduces this kind of change, there is a
>> > git config variable that one can set to suppress it.
>> > That way one has fine grade control when to suppress it (one repo only...globally).
>>
>> I think this comes from 9df53c5d (Recommend git-filter-repo instead
>> of git-filter-branch, 2019-09-04).
>>
>> FWIW, I personally do not think an environment is a worse choice
>> over configuration variable in this particular case.  The large
>> scale rewriting of the entire history in the repository by its
>> nature is an one-off operation that ought to happen only rarely,
>> so a one-shot
>>
>>         $ FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch ...
>>
>> that reminds the user every time would be more appropriate than a
>> configuration variable that has a more permanent squelching effect.
>>
>> If it were a new command line option may have been even better, as
>> an environment variable can be defined in .*rc and forgotten, but a
>> command line option needs to be typed every time and would serve as
>> a better reminder (yes, I know it can also be aliased away, so it
>> may not make much practical difference either way).
>>
>> But I'll let the author of the feature to comment.
>>
>> Thanks.
>
>I agree with Junio that filter-branch's one-off nature means that not
>providing a configuration variable seems reasonable in this case.  If
>someone else were to go to the effort of implementing some
>configuration option here, I wouldn't be that strongly against it,
>though I'd rather just let filter-branch lie dormant and stable.
>
>A new command line option might have been better, but it didn't occur
>to me at the time this change was made and I hesitate to needlessly
>force people to adapt again.

I implemented the change and sent a pull request on github (#912) but failed at GitGitGadget. Anyways, here’s the patch:

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

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index fea7964617..fb55afcc86 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -83,15 +83,21 @@ 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
-        rewrites.  Hit Ctrl-C before proceeding to abort, then use an
+        rewrites. Hit Ctrl-C before proceeding to abort, then use an
         alternative filtering tool such as 'git filter-repo'
-        (https://github.com/newren/git-filter-repo/) instead.  See the
+        (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"
--
2.29.0



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

* Re: Suppressing filter-branch warning
  2020-11-10 11:21     ` Daniel Höpfl
@ 2020-11-10 12:15       ` Johannes Schindelin
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Schindelin @ 2020-11-10 12:15 UTC (permalink / raw)
  To: Daniel Höpfl; +Cc: Elijah Newren, Junio C Hamano, Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 5721 bytes --]

Hi Daniel,

On Tue, 10 Nov 2020, Daniel Höpfl wrote:

> Hallo Elijah,
>
> On Fri, Nov 06, 2020 at 12:12:55PM -0800, Elijah Newren wrote:
> >On Fri, Nov 6, 2020 at 10:06 AM Junio C Hamano <gitster@pobox.com> wrote:
> > >
> > > Daniel Höpfl <daniel@hoepfl.de> writes:
> > >
> > > > Hello there,
> > > >
> > > > What did you do before the bug happened? (Steps to reproduce your issue)
> > > > git filter-branch -f --env-filter '' --tag-name-filter cat -- HEAD
> > > >
> > > > What did you expect to happen? (Expected behavior)
> > > > See below (difference).
> > > >
> > > > What happened instead? (Actual behavior)
> > > > When using git filter-branch, the following message is shown:
> > > >
> > > > ----------8<-----------------------------------------------------
> > > > WARNING: git-filter-branch has a glut of gotchas generating mangled
> > > > history
> > > >         rewrites.  Hit Ctrl-C before proceeding to abort, then use an
> > > >         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.
> > > > ----------8<-----------------------------------------------------
> > > >
> > > > You can suppress this by setting the environment variable shown.
> > > >
> > > > What's different between what you expected and what actually happened?
> > > >
> > > > Normally, when git introduces this kind of change, there is a
> > > > git config variable that one can set to suppress it.
> > > > That way one has fine grade control when to suppress it (one repo
> > > > only...globally).
> > >
> > > I think this comes from 9df53c5d (Recommend git-filter-repo instead
> > > of git-filter-branch, 2019-09-04).
> > >
> > > FWIW, I personally do not think an environment is a worse choice
> > > over configuration variable in this particular case.  The large
> > > scale rewriting of the entire history in the repository by its
> > > nature is an one-off operation that ought to happen only rarely,
> > > so a one-shot
> > >
> > >         $ FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch ...
> > >
> > > that reminds the user every time would be more appropriate than a
> > > configuration variable that has a more permanent squelching effect.
> > >
> > > If it were a new command line option may have been even better, as
> > > an environment variable can be defined in .*rc and forgotten, but a
> > > command line option needs to be typed every time and would serve as
> > > a better reminder (yes, I know it can also be aliased away, so it
> > > may not make much practical difference either way).
> > >
> > > But I'll let the author of the feature to comment.
> > >
> > > Thanks.
> >
> >I agree with Junio that filter-branch's one-off nature means that not
> >providing a configuration variable seems reasonable in this case.  If
> >someone else were to go to the effort of implementing some
> >configuration option here, I wouldn't be that strongly against it,
> >though I'd rather just let filter-branch lie dormant and stable.
> >
> >A new command line option might have been better, but it didn't occur
> >to me at the time this change was made and I hesitate to needlessly
> >force people to adapt again.
>
> I implemented the change and sent a pull request on github (#912) but failed
> at GitGitGadget. Anyways, here’s the patch:
>
> ---
> git-filter-branch.sh | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/git-filter-branch.sh b/git-filter-branch.sh
> index fea7964617..fb55afcc86 100755
> --- a/git-filter-branch.sh
> +++ b/git-filter-branch.sh
> @@ -83,15 +83,21 @@ 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
> -        rewrites.  Hit Ctrl-C before proceeding to abort, then use an
> +        rewrites. Hit Ctrl-C before proceeding to abort, then use an
>         alternative filtering tool such as 'git filter-repo'
> -        (https://github.com/newren/git-filter-repo/) instead.  See the
> +        (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"
> --
> 2.29.0

The first obstacle was that somebody had to `/allow` you (you probably
missed it; https://github.com/git/git/pull/912/#issuecomment-724637575 is
a bit of a verbose welcome message, but it _does_ mention it in the
"Contributing the patches" section).

The GitGitGadget Pull Request still has the following issues:

- the commit is not signed off
- the commit message is not in a good shape (it consists of a single,
  too-long line)

I also left a couple more comments about the patch itself here:
https://github.com/git/git/pull/912/#pullrequestreview-527112997

Ciao,
Johannes

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

end of thread, other threads:[~2020-11-10 12:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06  9:04 Suppressing filter-branch warning Daniel Höpfl
2020-11-06 18:06 ` Junio C Hamano
2020-11-06 20:12   ` Elijah Newren
2020-11-10 11:21     ` Daniel Höpfl
2020-11-10 12:15       ` Johannes Schindelin

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).