{"thread":{"id":"55938","subject":"[PATCH] Add config variable besides env variable to squelch \"do-not-use\" warning.","startedAt":"2021-06-15T19:38:39Z","lastAt":"2021-06-16T08:03:16Z","messageCount":3,"participants":["Daniel Höpfl via GitGitGadget","Junio C Hamano","Elijah Newren"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"427526","messageId":"pull.912.git.git.1623785914202.gitgitgadget@gmail.com","threadId":"55938","inReplyTo":null,"subject":"[PATCH] Add config variable besides env variable to squelch \"do-not-use\" warning.","fromName":"Daniel Höpfl via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-06-15T19:38:33Z","receivedAt":"2021-06-15T19:38:39Z","isPatch":true,"sender":{"key":"daniel@hoepfl.de","avatar":null},"body":"From: =?UTF-8?q?Daniel=20H=C3=B6pfl?= <daniel@hoepfl.de>\n\nIn addition to the environment variable FILTER_BRANCH_SQUELCH_WARNING,\nthe git config filter-branch.squelchWarning is checked to see if the\nusage warning should be squelched.\n\nSigned-off-by: Daniel Höpfl <daniel@hoepfl.de>\n---\n    Add filter-branch.squelchWarning git config alongside\n    FILTER_BRANCH_SQUELCH_WARNING\n    \n    In addition to the environment variable FILTER_BRANCH_SQUELCH_WARNING,\n    the git config filter-branch.squelchWarning is checked to see if the\n    usage warning should be squelched.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-912%2Fdhoepfl%2FFILTER_BRANCH_SQUELCH_WARNING-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-912/dhoepfl/FILTER_BRANCH_SQUELCH_WARNING-v1\nPull-Request: https://github.com/git/git/pull/912\n\n git-filter-branch.sh | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/git-filter-branch.sh b/git-filter-branch.sh\nindex fea796461721..d33db14a2a84 100755\n--- a/git-filter-branch.sh\n+++ b/git-filter-branch.sh\n@@ -83,7 +83,8 @@ set_ident () {\n \tfinish_ident COMMITTER\n }\n \n-if test -z \"$FILTER_BRANCH_SQUELCH_WARNING$GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS\"\n+if test -z \"$FILTER_BRANCH_SQUELCH_WARNING$GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS\" &&\n+   test \"$(git config --bool filter-branch.squelchWarning)\" != true\n then\n \tcat <<EOF\n WARNING: git-filter-branch has a glut of gotchas generating mangled history\n@@ -91,7 +92,12 @@ WARNING: git-filter-branch has a glut of gotchas generating mangled history\n \t alternative filtering tool such as 'git filter-repo'\n \t (https://github.com/newren/git-filter-repo/) instead.  See the\n \t filter-branch manual page for more details; to squelch this warning,\n-\t set FILTER_BRANCH_SQUELCH_WARNING=1.\n+\t set FILTER_BRANCH_SQUELCH_WARNING=1 or run the following command:\n+\n+\t    git config filter-branch.squelchWarning true\n+\n+\t You can replace \"git config\" with \"git config --global\" to disable\n+\t the warning for all repositories.\n EOF\n \tsleep 10\n \tprintf \"Proceeding with filter-branch...\\n\\n\"\n\nbase-commit: e4d83eee9239207622e2b1cc43967da5051c189c\n-- \ngitgitgadget\n"},{"id":"427573","messageId":"xmqqy2baqvxv.fsf@gitster.g","threadId":"55938","inReplyTo":"pull.912.git.git.1623785914202.gitgitgadget@gmail.com","subject":"Re: [PATCH] Add config variable besides env variable to squelch \"do-not-use\" warning.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-06-16T04:23:40Z","receivedAt":"2021-06-16T04:23:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Daniel Höpfl via GitGitGadget\"  <gitgitgadget@gmail.com> writes:\n\n> From: =?UTF-8?q?Daniel=20H=C3=B6pfl?= <daniel@hoepfl.de>\n>\n> In addition to the environment variable FILTER_BRANCH_SQUELCH_WARNING,\n> the git config filter-branch.squelchWarning is checked to see if the\n> usage warning should be squelched.\n\nThanks for trying to improve the system.\n\nA configuration variable that is used to squelch warning messages\nrelated to migration and transition typically lives under advice.*\nhierarchy, so something ike \"advice.weanOffOfFilterBranch\" may be a\nmore appropriate name for this new knob.\n\nHaving said that.\n\nAs this message with environment as an escape hatch was added as a\nway to strongly discourage users from keep using the command, I am\nfairly negative to a change that adds yet another way to make it\neasier to keep using it.\n\nElijah, who did 9df53c5d (Recommend git-filter-repo instead of\ngit-filter-branch, 2019-09-04), added to CC list for input.\n\nThanks.\n\n> Signed-off-by: Daniel Höpfl <daniel@hoepfl.de>\n> ---\n>     Add filter-branch.squelchWarning git config alongside\n>     FILTER_BRANCH_SQUELCH_WARNING\n>     \n>     In addition to the environment variable FILTER_BRANCH_SQUELCH_WARNING,\n>     the git config filter-branch.squelchWarning is checked to see if the\n>     usage warning should be squelched.\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-912%2Fdhoepfl%2FFILTER_BRANCH_SQUELCH_WARNING-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-912/dhoepfl/FILTER_BRANCH_SQUELCH_WARNING-v1\n> Pull-Request: https://github.com/git/git/pull/912\n>\n>  git-filter-branch.sh | 10 ++++++++--\n>  1 file changed, 8 insertions(+), 2 deletions(-)\n>\n> diff --git a/git-filter-branch.sh b/git-filter-branch.sh\n> index fea796461721..d33db14a2a84 100755\n> --- a/git-filter-branch.sh\n> +++ b/git-filter-branch.sh\n> @@ -83,7 +83,8 @@ set_ident () {\n>  \tfinish_ident COMMITTER\n>  }\n>  \n> -if test -z \"$FILTER_BRANCH_SQUELCH_WARNING$GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS\"\n> +if test -z \"$FILTER_BRANCH_SQUELCH_WARNING$GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS\" &&\n> +   test \"$(git config --bool filter-branch.squelchWarning)\" != true\n>  then\n>  \tcat <<EOF\n>  WARNING: git-filter-branch has a glut of gotchas generating mangled history\n> @@ -91,7 +92,12 @@ WARNING: git-filter-branch has a glut of gotchas generating mangled history\n>  \t alternative filtering tool such as 'git filter-repo'\n>  \t (https://github.com/newren/git-filter-repo/) instead.  See the\n>  \t filter-branch manual page for more details; to squelch this warning,\n> -\t set FILTER_BRANCH_SQUELCH_WARNING=1.\n> +\t set FILTER_BRANCH_SQUELCH_WARNING=1 or run the following command:\n> +\n> +\t    git config filter-branch.squelchWarning true\n> +\n> +\t You can replace \"git config\" with \"git config --global\" to disable\n> +\t the warning for all repositories.\n>  EOF\n>  \tsleep 10\n>  \tprintf \"Proceeding with filter-branch...\\n\\n\"\n>\n> base-commit: e4d83eee9239207622e2b1cc43967da5051c189c\n"},{"id":"427585","messageId":"CABPp-BFiD5eYNXsRk=f-5k4oDeCHBW7_pd8iqYYBKsrd6evC9g@mail.gmail.com","threadId":"55938","inReplyTo":"xmqqy2baqvxv.fsf@gitster.g","subject":"Re: [PATCH] Add config variable besides env variable to squelch \"do-not-use\" warning.","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2021-06-16T08:03:02Z","receivedAt":"2021-06-16T08:03:16Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, Jun 15, 2021 at 9:23 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> \"Daniel Höpfl via GitGitGadget\"  <gitgitgadget@gmail.com> writes:\n>\n> > From: =?UTF-8?q?Daniel=20H=C3=B6pfl?= <daniel@hoepfl.de>\n> >\n> > In addition to the environment variable FILTER_BRANCH_SQUELCH_WARNING,\n> > the git config filter-branch.squelchWarning is checked to see if the\n> > usage warning should be squelched.\n>\n> Thanks for trying to improve the system.\n>\n> A configuration variable that is used to squelch warning messages\n> related to migration and transition typically lives under advice.*\n> hierarchy, so something ike \"advice.weanOffOfFilterBranch\" may be a\n> more appropriate name for this new knob.\n>\n> Having said that.\n>\n> As this message with environment as an escape hatch was added as a\n> way to strongly discourage users from keep using the command, I am\n> fairly negative to a change that adds yet another way to make it\n> easier to keep using it.\n>\n> Elijah, who did 9df53c5d (Recommend git-filter-repo instead of\n> git-filter-branch, 2019-09-04), added to CC list for input.\n\nYeah, I generally would like to discourage it but...\n\nBack when we put this strong discouragement and escape hatch in, I\nwasn't aware of anything that could be done in filter-branch that was\nhard to do in filter-repo.  However, since then, a user reported they\nwanted to re-sign commits after a rewrite.  Since fast-import does not\n(currently) provide a way to sign commits, and filter-repo is built on\ntop of fast-export and fast-import, this makes it rather difficult for\nfilter-repo to do.  (I think it still can, given all the shenanigans I\ndid to create filter-branch-ish as a rewrite of filter-branch on top\nof filter-repo, but that comes with nearly all the same caveats as\nfilter-branch if used directly, and is a huge amount of code to lift\nto try to use outside of filter-branch-ish.)\n\nSince there's a valid use for filter-branch (even if rare) that isn't\nreadily done in filter-repo, adding the option Daniel requests makes\nsense.\n"}]}