{"thread":{"id":"56431","subject":"[PATCH 0/9] remove dead shell code","startedAt":"2021-09-02T16:01:25Z","lastAt":"2021-09-13T03:28:18Z","messageCount":39,"participants":["Ævar Arnfjörð Bjarmason","Philippe Blain","Peter Baumann","Junio C Hamano","Andrei Rybak","Carlo Arenas","Phillip Wood"],"isPatch":true,"patchVersion":1,"patchTotal":9},"messages":[{"id":"434577","messageId":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","threadId":"56431","inReplyTo":null,"subject":"[PATCH 0/9] remove dead shell code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T16:01:07Z","receivedAt":"2021-09-02T16:01:25Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove dead shell code in git-sh-setup, inspired by parallel\ndiscussion on another topic (but the two don't conflict):\nhttps://lore.kernel.org/git/87lf4f9gre.fsf@evledraar.gmail.com/\n\nThe last two patches were picked from a dropped series of mine\nsubmitted earlier this year, it was dropped because of other more\ncomplex patches that I haven't included here:\nhttps://lore.kernel.org/git/20210311001447.28254-1-avarab@gmail.com/\n\nÆvar Arnfjörð Bjarmason (9):\n  git-sh-setup: remove unused set_reflog_action() function\n  git-sh-setup: remove unused git_editor() function\n  git-sh-setup: remove unused git_pager() function\n  git-sh-setup: remove unused sane_egrep() function\n  git-sh-setup: remove unused require_work_tree_exists() function\n  git-sh-setup: move create_virtual_base() to mergetools/p4merge\n  git-sh-setup: move peel_committish() function to git-subtree.sh\n  git-bisect: remove unused SHA-1 $x40 shell variable\n  test-lib: remove unused $_x40 and $_z40 variables\n\n Documentation/git-sh-setup.txt |  24 --------\n Documentation/git.txt          |   4 --\n contrib/subtree/git-subtree.sh |  12 ++++\n git-bisect.sh                  |   2 -\n git-sh-setup.sh                | 103 ---------------------------------\n git-submodule.sh               |   5 --\n mergetools/p4merge             |  12 ++++\n t/t7006-pager.sh               |  13 -----\n t/test-lib.sh                  |   6 +-\n 9 files changed, 26 insertions(+), 155 deletions(-)\n\n-- \n2.33.0.814.gb82868f05f3\n\n"},{"id":"434578","messageId":"patch-1.9-2e3ed8061d5-20210902T155758Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","subject":"[PATCH 1/9] git-sh-setup: remove unused set_reflog_action() function","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T16:01:08Z","receivedAt":"2021-09-02T16:01:27Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the set_reflog_action() function last used in the\ngit-legacy-rebase.sh script removed in d03ebd411c6 (rebase: remove the\nrebase.useBuiltin setting, 2019-03-18).\n\nWhen the documentation I'm removing from git.txt was added in\nc3e2d18996e (setup_reflog_action: document the rules for using\nGIT_REFLOG_ACTION, 2013-06-19) we had git-pull.sh, git-am.sh and\ngit-rebase.sh using this in-tree, an addition to various example\nscripts later removed in 49eb8d39c78 (Remove contrib/examples/*,\n2018-03-25).\n\nSince this part of the documentation was aimed at those writing\nscripts in git.git we're long past the point where we should remove\nit, this still leaves the description of the GIT_REFLOG_ACTION\nvariable.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Documentation/git-sh-setup.txt |  7 ------\n Documentation/git.txt          |  4 ----\n git-sh-setup.sh                | 42 ----------------------------------\n 3 files changed, 53 deletions(-)\n\ndiff --git a/Documentation/git-sh-setup.txt b/Documentation/git-sh-setup.txt\nindex 8632612c31d..1ae15905492 100644\n--- a/Documentation/git-sh-setup.txt\n+++ b/Documentation/git-sh-setup.txt\n@@ -40,13 +40,6 @@ die::\n usage::\n \tdie with the usage message.\n \n-set_reflog_action::\n-\tSet `GIT_REFLOG_ACTION` environment to a given string (typically\n-\tthe name of the program) unless it is already set.  Whenever\n-\tthe script runs a `git` command that updates refs, a reflog\n-\tentry is created using the value of this string to leave the\n-\trecord of what command updated the ref.\n-\n git_editor::\n \truns an editor of user's choice (GIT_EDITOR, core.editor, VISUAL or\n \tEDITOR) on a given file, but error out if no editor is specified\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 6dd241ef838..38bc1403313 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -857,10 +857,6 @@ for full details.\n \ttrack of the reason why the ref was updated (which is\n \ttypically the name of the high-level command that updated\n \tthe ref), in addition to the old and new values of the ref.\n-\tA scripted Porcelain command can use set_reflog_action\n-\thelper function in `git-sh-setup` to set its name to this\n-\tvariable when it is invoked as the top level command by the\n-\tend user, to be recorded in the body of the reflog.\n \n `GIT_REF_PARANOIA`::\n \tIf set to `1`, include broken or badly named refs when iterating\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 10d97641856..ee6935ca455 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -106,48 +106,6 @@ $LONG_USAGE\")\"\n \tesac\n fi\n \n-# Set the name of the end-user facing command in the reflog when the\n-# script may update refs.  When GIT_REFLOG_ACTION is already set, this\n-# will not overwrite it, so that a scripted Porcelain (e.g. \"git\n-# rebase\") can set it to its own name (e.g. \"rebase\") and then call\n-# another scripted Porcelain (e.g. \"git am\") and a call to this\n-# function in the latter will keep the name of the end-user facing\n-# program (e.g. \"rebase\") in GIT_REFLOG_ACTION, ensuring whatever it\n-# does will be record as actions done as part of the end-user facing\n-# operation (e.g. \"rebase\").\n-#\n-# NOTE NOTE NOTE: consequently, after assigning a specific message to\n-# GIT_REFLOG_ACTION when calling a \"git\" command to record a custom\n-# reflog message, do not leave that custom value in GIT_REFLOG_ACTION,\n-# after you are done.  Other callers of \"git\" commands that rely on\n-# writing the default \"program name\" in reflog expect the variable to\n-# contain the value set by this function.\n-#\n-# To use a custom reflog message, do either one of these three:\n-#\n-# (a) use a single-shot export form:\n-#     GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: preparing frotz\" \\\n-#         git command-that-updates-a-ref\n-#\n-# (b) save the original away and restore:\n-#     SAVED_ACTION=$GIT_REFLOG_ACTION\n-#     GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: preparing frotz\"\n-#     git command-that-updates-a-ref\n-#     GIT_REFLOG_ACITON=$SAVED_ACTION\n-#\n-# (c) assign the variable in a subshell:\n-#     (\n-#         GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: preparing frotz\"\n-#         git command-that-updates-a-ref\n-#     )\n-set_reflog_action() {\n-\tif [ -z \"${GIT_REFLOG_ACTION:+set}\" ]\n-\tthen\n-\t\tGIT_REFLOG_ACTION=\"$*\"\n-\t\texport GIT_REFLOG_ACTION\n-\tfi\n-}\n-\n git_editor() {\n \tif test -z \"${GIT_EDITOR:+set}\"\n \tthen\n-- \n2.33.0.814.gb82868f05f3\n\n"},{"id":"434579","messageId":"patch-2.9-7d3ea928099-20210902T155758Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","subject":"[PATCH 2/9] git-sh-setup: remove unused git_editor() function","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T16:01:09Z","receivedAt":"2021-09-02T16:01:28Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the git_editor() function last referenced in\n49eb8d39c78 (Remove contrib/examples/*, 2018-03-25).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Documentation/git-sh-setup.txt | 5 -----\n git-sh-setup.sh                | 9 ---------\n 2 files changed, 14 deletions(-)\n\ndiff --git a/Documentation/git-sh-setup.txt b/Documentation/git-sh-setup.txt\nindex 1ae15905492..2a28361cf66 100644\n--- a/Documentation/git-sh-setup.txt\n+++ b/Documentation/git-sh-setup.txt\n@@ -40,11 +40,6 @@ die::\n usage::\n \tdie with the usage message.\n \n-git_editor::\n-\truns an editor of user's choice (GIT_EDITOR, core.editor, VISUAL or\n-\tEDITOR) on a given file, but error out if no editor is specified\n-\tand the terminal is dumb.\n-\n is_bare_repository::\n \toutputs `true` or `false` to the standard output stream\n \tto indicate if the repository is a bare repository\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex ee6935ca455..cfedda79471 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -106,15 +106,6 @@ $LONG_USAGE\")\"\n \tesac\n fi\n \n-git_editor() {\n-\tif test -z \"${GIT_EDITOR:+set}\"\n-\tthen\n-\t\tGIT_EDITOR=\"$(git var GIT_EDITOR)\" || return $?\n-\tfi\n-\n-\teval \"$GIT_EDITOR\" '\"$@\"'\n-}\n-\n git_pager() {\n \tif test -t 1\n \tthen\n-- \n2.33.0.814.gb82868f05f3\n\n"},{"id":"434580","messageId":"patch-3.9-73e540896fc-20210902T155758Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","subject":"[PATCH 3/9] git-sh-setup: remove unused git_pager() function","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T16:01:10Z","receivedAt":"2021-09-02T16:01:28Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the git_editor() function last referenced by non-test code code\nin 49eb8d39c78 (Remove contrib/examples/*, 2018-03-25).\n\nWe can also remove the test for this added in 995bc22d7f8 (pager: move\npager-specific setup into the build, 2016-08-04), the test that\nactually matters is the one added in e54c1f2d253 (pager: set LV=-c\nalongside LESS=FRSX, 2014-01-06) just above the removed test.\n\nI.e. we don't care if the \"LESS\" and \"LV\" variables are set by\ngit-sh-setup anymore, no built-in uses them, we do care that pager.c\nsets them, which we still test for.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-sh-setup.sh  | 16 ----------------\n t/t7006-pager.sh | 13 -------------\n 2 files changed, 29 deletions(-)\n\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex cfedda79471..d4e8225affa 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -106,22 +106,6 @@ $LONG_USAGE\")\"\n \tesac\n fi\n \n-git_pager() {\n-\tif test -t 1\n-\tthen\n-\t\tGIT_PAGER=$(git var GIT_PAGER)\n-\telse\n-\t\tGIT_PAGER=cat\n-\tfi\n-\tfor vardef in @@PAGER_ENV@@\n-\tdo\n-\t\tvar=${vardef%%=*}\n-\t\teval \": \\\"\\${$vardef}\\\" && export $var\"\n-\tdone\n-\n-\teval \"$GIT_PAGER\" '\"$@\"'\n-}\n-\n sane_grep () {\n \tGREP_OPTIONS= LC_ALL=C grep @@SANE_TEXT_GREP@@ \"$@\"\n }\ndiff --git a/t/t7006-pager.sh b/t/t7006-pager.sh\nindex 0e7cf75435e..08f712a4497 100755\n--- a/t/t7006-pager.sh\n+++ b/t/t7006-pager.sh\n@@ -49,19 +49,6 @@ test_expect_success TTY 'LESS and LV envvars are set for pagination' '\n \tgrep ^LV= pager-env.out\n '\n \n-test_expect_success !MINGW,TTY 'LESS and LV envvars set by git-sh-setup' '\n-\t(\n-\t\tsane_unset LESS LV &&\n-\t\tPAGER=\"env >pager-env.out; wc\" &&\n-\t\texport PAGER &&\n-\t\tPATH=\"$(git --exec-path):$PATH\" &&\n-\t\texport PATH &&\n-\t\ttest_terminal sh -c \". git-sh-setup && git_pager\"\n-\t) &&\n-\tgrep ^LESS= pager-env.out &&\n-\tgrep ^LV= pager-env.out\n-'\n-\n test_expect_success TTY 'some commands do not use a pager' '\n \trm -f paginated.out &&\n \ttest_terminal git rev-list HEAD &&\n-- \n2.33.0.814.gb82868f05f3\n\n"},{"id":"434581","messageId":"patch-4.9-73f0676db7a-20210902T155758Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","subject":"[PATCH 4/9] git-sh-setup: remove unused sane_egrep() function","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T16:01:11Z","receivedAt":"2021-09-02T16:01:31Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The is_zero_oid() function in git-submodule.sh has not been used since\ne83e3333b57 (submodule: port submodule subcommand 'summary' from shell\nto C, 2020-08-13), so we can remove it, and the sane_egrep() function,\ndead is_zero_oid() was the only function which still referenced it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-sh-setup.sh  | 4 ----\n git-submodule.sh | 5 -----\n 2 files changed, 9 deletions(-)\n\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex d4e8225affa..a2a28982b6d 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -110,10 +110,6 @@ sane_grep () {\n \tGREP_OPTIONS= LC_ALL=C grep @@SANE_TEXT_GREP@@ \"$@\"\n }\n \n-sane_egrep () {\n-\tGREP_OPTIONS= LC_ALL=C egrep @@SANE_TEXT_GREP@@ \"$@\"\n-}\n-\n is_bare_repository () {\n \tgit rev-parse --is-bare-repository\n }\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex dbd2ec20503..aeb96c58243 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -63,11 +63,6 @@ isnumber()\n \tn=$(($1 + 0)) 2>/dev/null && test \"$n\" = \"$1\"\n }\n \n-# Given a full hex object ID, is this the zero OID?\n-is_zero_oid () {\n-\techo \"$1\" | sane_egrep '^0+$' >/dev/null 2>&1\n-}\n-\n # Sanitize the local git environment for use within a submodule. We\n # can't simply use clear_local_git_env since we want to preserve some\n # of the settings from GIT_CONFIG_PARAMETERS.\n-- \n2.33.0.814.gb82868f05f3\n\n"},{"id":"434582","messageId":"patch-5.9-dc4dd7d1399-20210902T155758Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","subject":"[PATCH 5/9] git-sh-setup: remove unused require_work_tree_exists() function","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T16:01:12Z","receivedAt":"2021-09-02T16:01:37Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The last code that used the require_work_tree_exists() function went\naway in d03ebd411c6 (rebase: remove the rebase.useBuiltin setting,\n2019-03-18), let's remove it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Documentation/git-sh-setup.txt | 6 ------\n git-sh-setup.sh                | 8 --------\n 2 files changed, 14 deletions(-)\n\ndiff --git a/Documentation/git-sh-setup.txt b/Documentation/git-sh-setup.txt\nindex 2a28361cf66..1d8c87e9b2f 100644\n--- a/Documentation/git-sh-setup.txt\n+++ b/Documentation/git-sh-setup.txt\n@@ -52,12 +52,6 @@ require_work_tree::\n \tchecks if the current directory is within the working tree\n \tof the repository, and otherwise dies.\n \n-require_work_tree_exists::\n-\tchecks if the working tree associated with the repository\n-\texists, and otherwise dies.  Often done before calling\n-\tcd_to_toplevel, which is impossible to do if there is no\n-\tworking tree.\n-\n require_clean_work_tree <action> [<hint>]::\n \tchecks that the working tree and index associated with the\n \trepository have no uncommitted changes to tracked files.\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex a2a28982b6d..363c0096842 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -122,14 +122,6 @@ cd_to_toplevel () {\n \t}\n }\n \n-require_work_tree_exists () {\n-\tif test \"z$(git rev-parse --is-bare-repository)\" != zfalse\n-\tthen\n-\t\tprogram_name=$0\n-\t\tdie \"$(eval_gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n-\tfi\n-}\n-\n require_work_tree () {\n \ttest \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" = true || {\n \t\tprogram_name=$0\n-- \n2.33.0.814.gb82868f05f3\n\n"},{"id":"434583","messageId":"patch-6.9-d2d65f3d77f-20210902T155758Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","subject":"[PATCH 6/9] git-sh-setup: move create_virtual_base() to mergetools/p4merge","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T16:01:13Z","receivedAt":"2021-09-02T16:01:37Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the create_virtual_base() function out of \"git-sh-setup\" to its\nonly user, \"mergetools/p4merge\". Since 1a92e53ba36 (merge-one-file:\nuse empty blob for add/add base, 2016-02-23) when\ngit-merge-one-file.sh stopped using it, it has only been used in\n\"mergetools/p4merge\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Documentation/git-sh-setup.txt |  6 ------\n git-sh-setup.sh                | 12 ------------\n mergetools/p4merge             | 12 ++++++++++++\n 3 files changed, 12 insertions(+), 18 deletions(-)\n\ndiff --git a/Documentation/git-sh-setup.txt b/Documentation/git-sh-setup.txt\nindex 1d8c87e9b2f..2febe754206 100644\n--- a/Documentation/git-sh-setup.txt\n+++ b/Documentation/git-sh-setup.txt\n@@ -66,12 +66,6 @@ get_author_ident_from_commit::\n \toutputs code for use with eval to set the GIT_AUTHOR_NAME,\n \tGIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit.\n \n-create_virtual_base::\n-\tmodifies the first file so only lines in common with the\n-\tsecond file remain. If there is insufficient common material,\n-\tthen the first file is left empty. The result is suitable\n-\tas a virtual base input for a 3-way merge.\n-\n GIT\n ---\n Part of the linkgit:git[1] suite\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 363c0096842..6a21238dc0e 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -238,18 +238,6 @@ clear_local_git_env() {\n \tunset $(git rev-parse --local-env-vars)\n }\n \n-# Generate a virtual base file for a two-file merge. Uses git apply to\n-# remove lines from $1 that are not in $2, leaving only common lines.\n-create_virtual_base() {\n-\tsz0=$(wc -c <\"$1\")\n-\t@@DIFF@@ -u -La/\"$1\" -Lb/\"$1\" \"$1\" \"$2\" | git apply --no-add\n-\tsz1=$(wc -c <\"$1\")\n-\n-\t# If we do not have enough common material, it is not\n-\t# worth trying two-file merge using common subsections.\n-\texpr $sz0 \\< $sz1 \\* 2 >/dev/null || : >\"$1\"\n-}\n-\n \n # Platform specific tweaks to work around some commands\n case $(uname -s) in\ndiff --git a/mergetools/p4merge b/mergetools/p4merge\nindex 7a5b291dd28..23f8735efa2 100644\n--- a/mergetools/p4merge\n+++ b/mergetools/p4merge\n@@ -19,6 +19,18 @@ diff_cmd () {\n \tfi\n }\n \n+# Generate a virtual base file for a two-file merge. Uses git apply to\n+# remove lines from $1 that are not in $2, leaving only common lines.\n+create_virtual_base() {\n+\tsz0=$(wc -c <\"$1\")\n+\t@@DIFF@@ -u -La/\"$1\" -Lb/\"$1\" \"$1\" \"$2\" | git apply --no-add\n+\tsz1=$(wc -c <\"$1\")\n+\n+\t# If we do not have enough common material, it is not\n+\t# worth trying two-file merge using common subsections.\n+\texpr $sz0 \\< $sz1 \\* 2 >/dev/null || : >\"$1\"\n+}\n+\n merge_cmd () {\n \tif ! $base_present\n \tthen\n-- \n2.33.0.814.gb82868f05f3\n\n"},{"id":"434584","messageId":"patch-7.9-a3047b93f7d-20210902T155758Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","subject":"[PATCH 7/9] git-sh-setup: move peel_committish() function to git-subtree.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T16:01:14Z","receivedAt":"2021-09-02T16:01:39Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the peel_committish() function out of git-sh-setup to its only\nuser, contrib/subtree/git-subtree.sh. Since d03ebd411c6 (rebase:\nremove the rebase.useBuiltin setting, 2019-03-18) when\ngit-legacy-rebase.sh was removed, it has only been used in\ngit-subtree.sh.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n contrib/subtree/git-subtree.sh | 12 ++++++++++++\n git-sh-setup.sh                | 12 ------------\n 2 files changed, 12 insertions(+), 12 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 7f767b5c38f..a6deb57bcae 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -818,6 +818,18 @@ cmd_add_repository () {\n \tcmd_add_commit FETCH_HEAD\n }\n \n+peel_committish () {\n+\tcase \"$1\" in\n+\t:/*)\n+\t\tpeeltmp=$(git rev-parse --verify \"$1\") &&\n+\t\tgit rev-parse --verify \"${peeltmp}^0\"\n+\t\t;;\n+\t*)\n+\t\tgit rev-parse --verify \"${1}^0\"\n+\t\t;;\n+\tesac\n+}\n+\n # Usage: cmd_add_commit REV\n cmd_add_commit () {\n \t# The rev has already been validated by cmd_add(), we just\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 6a21238dc0e..9243353bc21 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -294,15 +294,3 @@ if test -z \"$NONGIT_OK\"\n then\n \tgit_dir_init\n fi\n-\n-peel_committish () {\n-\tcase \"$1\" in\n-\t:/*)\n-\t\tpeeltmp=$(git rev-parse --verify \"$1\") &&\n-\t\tgit rev-parse --verify \"${peeltmp}^0\"\n-\t\t;;\n-\t*)\n-\t\tgit rev-parse --verify \"${1}^0\"\n-\t\t;;\n-\tesac\n-}\n-- \n2.33.0.814.gb82868f05f3\n\n"},{"id":"434585","messageId":"patch-8.9-88dffac9088-20210902T155758Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","subject":"[PATCH 8/9] git-bisect: remove unused SHA-1 $x40 shell variable","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T16:01:15Z","receivedAt":"2021-09-02T16:01:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This variable was last used in code removed in\n06f5608c14 (bisect--helper: `bisect_start` shell function partially in\nC, 2019-01-02).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-bisect.sh | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 6a7afaea8da..b59f3aaad43 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -34,8 +34,6 @@ Please use \"git help bisect\" to get the full man page.'\n OPTIONS_SPEC=\n . git-sh-setup\n \n-_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n-_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n TERM_BAD=bad\n TERM_GOOD=good\n \n-- \n2.33.0.814.gb82868f05f3\n\n"},{"id":"434586","messageId":"patch-9.9-0fd1516af85-20210902T155758Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","subject":"[PATCH 9/9] test-lib: remove unused $_x40 and $_z40 variables","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T16:01:16Z","receivedAt":"2021-09-02T16:01:43Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"These two have fallen out of use with the SHA-256 migration.\n\nThe last use of $_x40 was removed in fc7e73d7ef (t4013: improve\ndiff-post-processor logic, 2020-08-21) and\n\nThe last use of $_z40 was removed in 7a868c51c2 (t5562: use $ZERO_OID,\n2019-12-21), but it was then needlessly refactored to be hash-agnostic\nin 192b517589 (t: use hash-specific lookup tables to define test\nconstants, 2020-02-22). We can just remove it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex abcfbed6d61..044a9231ae6 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -534,7 +534,7 @@ SQ=\\'\n # when case-folding filenames\n u200c=$(printf '\\342\\200\\214')\n \n-export _x05 _x35 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n+export _x05 _x35 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n \n # Each test should start with something like this, after copyright notices:\n #\n@@ -1422,10 +1422,9 @@ then\n fi\n \n # Convenience\n-# A regexp to match 5, 35 and 40 hexdigits\n+# A regexp to match 5 and 35 hexdigits\n _x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n _x35=\"$_x05$_x05$_x05$_x05$_x05$_x05$_x05\"\n-_x40=\"$_x35$_x05\"\n \n test_oid_init\n \n@@ -1434,7 +1433,6 @@ OID_REGEX=$(echo $ZERO_OID | sed -e 's/0/[0-9a-f]/g')\n OIDPATH_REGEX=$(test_oid_to_path $ZERO_OID | sed -e 's/0/[0-9a-f]/g')\n EMPTY_TREE=$(test_oid empty_tree)\n EMPTY_BLOB=$(test_oid empty_blob)\n-_z40=$ZERO_OID\n \n # Provide an implementation of the 'yes' utility; the upper bound\n # limit is there to help Windows that cannot stop this loop from\n-- \n2.33.0.814.gb82868f05f3\n\n"},{"id":"434587","messageId":"503e0203-90ce-ff81-4d6d-46088d6ca850@gmail.com","threadId":"56431","inReplyTo":"patch-3.9-73e540896fc-20210902T155758Z-avarab@gmail.com","subject":"Re: [PATCH 3/9] git-sh-setup: remove unused git_pager() function","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2021-09-02T16:34:41Z","receivedAt":"2021-09-02T16:34:48Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Ævar,\n\nLe 2021-09-02 à 12:01, Ævar Arnfjörð Bjarmason a écrit :\n> Remove the git_editor() function last referenced by non-test code code\n> in 49eb8d39c78 (Remove contrib/examples/*, 2018-03-25).\n> \n\ns/code code/code/\n\nThanks,\n\nPhilippe.\n"},{"id":"434588","messageId":"CAJm9OHfN9iXDt-rzu-wb=67y4PPpmCUgMfmZPy1JMBJkHG256g@mail.gmail.com","threadId":"56431","inReplyTo":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","subject":"Re: [PATCH 0/9] remove dead shell code","fromName":"Peter Baumann","fromEmail":"peter.baumann@gmail.com","sentAt":"2021-09-02T16:53:31Z","receivedAt":"2021-09-02T16:53:45Z","isPatch":true,"sender":{"key":"peter.baumann@gmail.com","avatar":null},"body":"On Thu, Sep 2, 2021 at 6:04 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n>\n> Remove dead shell code in git-sh-setup, inspired by parallel\n> discussion on another topic (but the two don't conflict):\n> https://lore.kernel.org/git/87lf4f9gre.fsf@evledraar.gmail.com/\n>\n> The last two patches were picked from a dropped series of mine\n> submitted earlier this year, it was dropped because of other more\n> complex patches that I haven't included here:\n> https://lore.kernel.org/git/20210311001447.28254-1-avarab@gmail.com/\n>\n[...]\n\nHm, I have scripts here, implementing some porcelain commands which\nfollow the same approach as\nthe git porcelain scripts, e.g.\n\n  #!/bin/bash\n  SUBDIRECTORY_OK=Yes\n  . git-sh-setup\n  require_work_tree\n  require_clean_work_tree\n  cd_to_toplevel || die \"Can't find top level for the git repo\"\n  set_reflog_action my-special-script                          # this\nwill be broken by the patch series\n\nI was under the impression that this is how it should be done when one\nneeds to write some custom git scripts.\nIf that is the case, then removing these functions might break some\nother users scripts out there.\nAt least  I have a quite an old self written script here which uses\n`set_reflog_action`.\nObviously I can manage and adapt the script, but the more generic\nquestion comes to mind if sourcing git-sh-setup\nby end users is the correct approach to write porcelain scripts!\n\n-Peter\n"},{"id":"434596","messageId":"xmqq5yvik8bc.fsf@gitster.g","threadId":"56431","inReplyTo":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","subject":"Re: [PATCH 0/9] remove dead shell code","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-09-02T20:53:59Z","receivedAt":"2021-09-02T20:54:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> Remove dead shell code in git-sh-setup, inspired by parallel\n> discussion on another topic (but the two don't conflict):\n> https://lore.kernel.org/git/87lf4f9gre.fsf@evledraar.gmail.com/\n>\n> The last two patches were picked from a dropped series of mine\n> submitted earlier this year, it was dropped because of other more\n> complex patches that I haven't included here:\n> https://lore.kernel.org/git/20210311001447.28254-1-avarab@gmail.com/\n>\n> Ævar Arnfjörð Bjarmason (9):\n>   git-sh-setup: remove unused set_reflog_action() function\n>   git-sh-setup: remove unused git_editor() function\n>   git-sh-setup: remove unused git_pager() function\n>   git-sh-setup: remove unused sane_egrep() function\n>   git-sh-setup: remove unused require_work_tree_exists() function\n>   git-sh-setup: move create_virtual_base() to mergetools/p4merge\n>   git-sh-setup: move peel_committish() function to git-subtree.sh\n>   git-bisect: remove unused SHA-1 $x40 shell variable\n>   test-lib: remove unused $_x40 and $_z40 variables\n\nWas \"unused\" above decided based solely on the presence of in-tree\nusers?  If that is the case, I do not think we want to take these\nsh-setup changes.\n\nThe implementation details of the remaining part of git-bisect.sh\nand test-lib.sh are OK, of course, as that is truly our local\nissue.\n\nThanks.\n"},{"id":"434597","messageId":"xmqqzgsuitmt.fsf@gitster.g","threadId":"56431","inReplyTo":"CAJm9OHfN9iXDt-rzu-wb=67y4PPpmCUgMfmZPy1JMBJkHG256g@mail.gmail.com","subject":"Re: [PATCH 0/9] remove dead shell code","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-09-02T20:56:26Z","receivedAt":"2021-09-02T20:56:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Peter Baumann <peter.baumann@gmail.com> writes:\n\n> Hm, I have scripts here, implementing some porcelain commands which\n> follow the same approach as\n> the git porcelain scripts, e.g.\n>\n>   #!/bin/bash\n>   SUBDIRECTORY_OK=Yes\n>   . git-sh-setup\n>   require_work_tree\n>   require_clean_work_tree\n>   cd_to_toplevel || die \"Can't find top level for the git repo\"\n>   set_reflog_action my-special-script                          # this\n> will be broken by the patch series\n>\n> I was under the impression that this is how it should be done when one\n> needs to write some custom git scripts.\n\nThe reason why output from \"git log --stat -- git-sh-setup.sh\" does\nnot have that much removal is exactly this.  These are part of our\npublished API.  It is very much appreciated that you raised this\npoint.\n\nThanks.\n\n"},{"id":"434598","messageId":"b110b970-c5e6-a15b-f92c-574c0781b358@gmail.com","threadId":"56431","inReplyTo":"503e0203-90ce-ff81-4d6d-46088d6ca850@gmail.com","subject":"Re: [PATCH 3/9] git-sh-setup: remove unused git_pager() function","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2021-09-02T21:13:03Z","receivedAt":"2021-09-02T21:13:21Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"On 02/09/2021 18:34, Philippe Blain wrote:\n> Hi Ævar,\n> \n> Le 2021-09-02 à 12:01, Ævar Arnfjörð Bjarmason a écrit :\n>> Remove the git_editor() function last referenced by non-test code code\n\nAlso s/git_editor/git_pager/\n\n>> in 49eb8d39c78 (Remove contrib/examples/*, 2018-03-25).\n>>\n> \n> s/code code/code/\n> \n> Thanks,\n> \n> Philippe.\n\n"},{"id":"434599","messageId":"CAPUEspj9YPJHcKzjGNR05-FnkzRoZJ0yKC1McA5wM06HgUPVHw@mail.gmail.com","threadId":"56431","inReplyTo":"xmqq5yvik8bc.fsf@gitster.g","subject":"Re: [PATCH 0/9] remove dead shell code","fromName":"Carlo Arenas","fromEmail":"carenas@gmail.com","sentAt":"2021-09-02T21:29:59Z","receivedAt":"2021-09-02T21:30:13Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Thu, Sep 2, 2021 at 1:58 PM Junio C Hamano <gitster@pobox.com> wrote:\n> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n> > Ævar Arnfjörð Bjarmason (9):\n> >   git-sh-setup: remove unused set_reflog_action() function\n> >   git-sh-setup: remove unused git_editor() function\n> >   git-sh-setup: remove unused git_pager() function\n> >   git-sh-setup: remove unused sane_egrep() function\n> >   git-sh-setup: remove unused require_work_tree_exists() function\n> >   git-sh-setup: move create_virtual_base() to mergetools/p4merge\n> >   git-sh-setup: move peel_committish() function to git-subtree.sh\n> >   git-bisect: remove unused SHA-1 $x40 shell variable\n> >   test-lib: remove unused $_x40 and $_z40 variables\n>\n> Was \"unused\" above decided based solely on the presence of in-tree\n> users?  If that is the case, I do not think we want to take these\n> sh-setup changes.\n>\n> The implementation details of the remaining part of git-bisect.sh\n> and test-lib.sh are OK, of course, as that is truly our local\n> issue.\n\nThe removal of sane_egrep() is also unlikely to cause issues, as it\nwasn't documented as a public API, and it seems similar to the\ngit-bisect's implementation details you refer to, except for\ngit-submodule.\n\nDropping it now would avoid having to change it to `grep -E` as egrep\ngets obsoleted.\n\nIn that line, git_pager() and peel_committish() aren't documented\neither; document or drop?\n\nCarlo\n"},{"id":"434605","messageId":"874kb2a9tp.fsf@evledraar.gmail.com","threadId":"56431","inReplyTo":"xmqq5yvik8bc.fsf@gitster.g","subject":"Re: [PATCH 0/9] remove dead shell code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T22:17:08Z","receivedAt":"2021-09-02T22:31:35Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Sep 02 2021, Junio C Hamano wrote:\n\n> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>\n>> Remove dead shell code in git-sh-setup, inspired by parallel\n>> discussion on another topic (but the two don't conflict):\n>> https://lore.kernel.org/git/87lf4f9gre.fsf@evledraar.gmail.com/\n>>\n>> The last two patches were picked from a dropped series of mine\n>> submitted earlier this year, it was dropped because of other more\n>> complex patches that I haven't included here:\n>> https://lore.kernel.org/git/20210311001447.28254-1-avarab@gmail.com/\n>>\n>> Ævar Arnfjörð Bjarmason (9):\n>>   git-sh-setup: remove unused set_reflog_action() function\n>>   git-sh-setup: remove unused git_editor() function\n>>   git-sh-setup: remove unused git_pager() function\n>>   git-sh-setup: remove unused sane_egrep() function\n>>   git-sh-setup: remove unused require_work_tree_exists() function\n>>   git-sh-setup: move create_virtual_base() to mergetools/p4merge\n>>   git-sh-setup: move peel_committish() function to git-subtree.sh\n>>   git-bisect: remove unused SHA-1 $x40 shell variable\n>>   test-lib: remove unused $_x40 and $_z40 variables\n>\n> Was \"unused\" above decided based solely on the presence of in-tree\n> users?  If that is the case, I do not think we want to take these\n> sh-setup changes.\n\nI should have remembered to reference the earlier discussion, but I\nthink we had this exact discussion around a year ago when I submitted\npatches to remove git-parse-remote.sh, and decided this direction was\nOK.\n\nSee a89a2fbfccd (parse-remote: remove this now-unused library,\n2020-11-14) and the thread starting at\n<20201111173738.GB9902@coredump.intra.peff.net>:\nhttps://lore.kernel.org/git/20201111173738.GB9902@coredump.intra.peff.net/\n\nYou'll know better what you meant, but I interpreted the docs you added\nfor git-sh-setup in 850844e28f7 (Documentation/git-sh-setup.txt:\nprogrammer's docs, 2007-01-17) as a guide for in-tree porcelain scripts.\n\nAs noted in my recently sent <87lf4f9gre.fsf@evledraar.gmail.com>\n(https://lore.kernel.org/git/87lf4f9gre.fsf@evledraar.gmail.com/) the\neventual goal I have in mind here is to get rid of git-sh-i18n.sh.\n\nIf we're set on maintaining these shell libraries indefinitely even\nafter in-tree users have gone away that pretty much means we can't do\nthat, which would be unfortunate. We continue paying for quite a bit of\ntechnical debt to extend certain parts of core C git functionality to\n*.sh and *.perl.\n"},{"id":"434606","messageId":"xmqqbl5aip0e.fsf@gitster.g","threadId":"56431","inReplyTo":"874kb2a9tp.fsf@evledraar.gmail.com","subject":"Re: [PATCH 0/9] remove dead shell code","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-09-02T22:36:17Z","receivedAt":"2021-09-02T22:36:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> You'll know better what you meant, but I interpreted the docs you added\n> for git-sh-setup in 850844e28f7 (Documentation/git-sh-setup.txt:\n> programmer's docs, 2007-01-17) as a guide for in-tree porcelain scripts.\n\nNo, it is not for \"in-tree\".  Especially back then, one of the Git's\ngoal was to be and to stay scriptable, and git-sh-setup was for those\nwho are scripting, either \"in-tree\" or custom Porcelain people wrote\naround Git as part of a larger Git ecosystem.\n\n"},{"id":"434608","messageId":"xmqq7dfyioq4.fsf@gitster.g","threadId":"56431","inReplyTo":"CAPUEspj9YPJHcKzjGNR05-FnkzRoZJ0yKC1McA5wM06HgUPVHw@mail.gmail.com","subject":"Re: [PATCH 0/9] remove dead shell code","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-09-02T22:42:27Z","receivedAt":"2021-09-02T22:42:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Carlo Arenas <carenas@gmail.com> writes:\n\n> Dropping it now would avoid having to change it to `grep -E` as egrep\n> gets obsoleted.\n\nKeeping it would isolate the callers from \"grep -E\" vs \"egrep\"\nbecause they do not need to know.  They can keep calling\nsane_egrep().\n\nHaving said that, I do not think anybody minds losing sane_egrep().\nMany helper functions in the shell library are about encapsulating\nthe knowledge we have on and around Git and making it easier for\nthird-party script writers to use the knowledge.  The functions like\nis_bare_repository(), cd_to_toplevel(), and git_pager() all fall\ninto that category.  sane_egrep is not that kind of a helper (it\nencapusulates our knowledge about GNU grep's quirk we found when we\ntried to use it in our scripts---third-party script writers do not\nneed help from Git experts on their use of egrep).\n\nThanks.\n"},{"id":"434767","messageId":"patch-v2-2.7-e7f3115797c-20210906T070201Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-v2-0.7-00000000000-20210906T070201Z-avarab@gmail.com","subject":"[PATCH v2 2/7] git-sh-setup: remove unused sane_egrep() function","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-06T07:05:13Z","receivedAt":"2021-09-06T07:05:28Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The is_zero_oid() function in git-submodule.sh has not been used since\ne83e3333b57 (submodule: port submodule subcommand 'summary' from shell\nto C, 2020-08-13), so we can remove it, and the sane_egrep() function,\ndead is_zero_oid() was the only function which still referenced it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-sh-setup.sh  | 4 ----\n git-submodule.sh | 5 -----\n 2 files changed, 9 deletions(-)\n\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 7ee4b0edff5..c170be07c7d 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -161,10 +161,6 @@ sane_grep () {\n \tGREP_OPTIONS= LC_ALL=C grep @@SANE_TEXT_GREP@@ \"$@\"\n }\n \n-sane_egrep () {\n-\tGREP_OPTIONS= LC_ALL=C egrep @@SANE_TEXT_GREP@@ \"$@\"\n-}\n-\n is_bare_repository () {\n \tgit rev-parse --is-bare-repository\n }\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex dbd2ec20503..aeb96c58243 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -63,11 +63,6 @@ isnumber()\n \tn=$(($1 + 0)) 2>/dev/null && test \"$n\" = \"$1\"\n }\n \n-# Given a full hex object ID, is this the zero OID?\n-is_zero_oid () {\n-\techo \"$1\" | sane_egrep '^0+$' >/dev/null 2>&1\n-}\n-\n # Sanitize the local git environment for use within a submodule. We\n # can't simply use clear_local_git_env since we want to preserve some\n # of the settings from GIT_CONFIG_PARAMETERS.\n-- \n2.33.0.821.gfd4106eadbd\n\n"},{"id":"434768","messageId":"patch-v2-3.7-d92e880fcfa-20210906T070201Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-v2-0.7-00000000000-20210906T070201Z-avarab@gmail.com","subject":"[PATCH v2 3/7] git-sh-setup: move peel_committish() function to git-subtree.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-06T07:05:14Z","receivedAt":"2021-09-06T07:05:29Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the peel_committish() function out of git-sh-setup to its only\nuser, contrib/subtree/git-subtree.sh. Since d03ebd411c6 (rebase:\nremove the rebase.useBuiltin setting, 2019-03-18) when\ngit-legacy-rebase.sh was removed, it has only been used in\ngit-subtree.sh.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n contrib/subtree/git-subtree.sh | 12 ++++++++++++\n git-sh-setup.sh                | 12 ------------\n 2 files changed, 12 insertions(+), 12 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 7f767b5c38f..a6deb57bcae 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -818,6 +818,18 @@ cmd_add_repository () {\n \tcmd_add_commit FETCH_HEAD\n }\n \n+peel_committish () {\n+\tcase \"$1\" in\n+\t:/*)\n+\t\tpeeltmp=$(git rev-parse --verify \"$1\") &&\n+\t\tgit rev-parse --verify \"${peeltmp}^0\"\n+\t\t;;\n+\t*)\n+\t\tgit rev-parse --verify \"${1}^0\"\n+\t\t;;\n+\tesac\n+}\n+\n # Usage: cmd_add_commit REV\n cmd_add_commit () {\n \t# The rev has already been validated by cmd_add(), we just\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex c170be07c7d..3fc8830cb36 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -365,15 +365,3 @@ if test -z \"$NONGIT_OK\"\n then\n \tgit_dir_init\n fi\n-\n-peel_committish () {\n-\tcase \"$1\" in\n-\t:/*)\n-\t\tpeeltmp=$(git rev-parse --verify \"$1\") &&\n-\t\tgit rev-parse --verify \"${peeltmp}^0\"\n-\t\t;;\n-\t*)\n-\t\tgit rev-parse --verify \"${1}^0\"\n-\t\t;;\n-\tesac\n-}\n-- \n2.33.0.821.gfd4106eadbd\n\n"},{"id":"434769","messageId":"cover-v2-0.7-00000000000-20210906T070201Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-0.9-00000000000-20210902T155758Z-avarab@gmail.com","subject":"[PATCH v2 0/7] remove dead & undocumented shell code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-06T07:05:11Z","receivedAt":"2021-09-06T07:05:30Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This re-roll should address all the comments on the v1, in particular\nall of the changes that removed in-tree unused functions that are\ndocumented in our manpages were ejected. This series is now only\nremovals of code that should always have been in-tree-only.\n\nThe minor change in 4/7 is new, and so is 5/7.\n\nÆvar Arnfjörð Bjarmason (7):\n  git-sh-setup: remove unused git_pager() function\n  git-sh-setup: remove unused sane_egrep() function\n  git-sh-setup: move peel_committish() function to git-subtree.sh\n  git-sh-setup: clear_local_git_env() function to git-submodule.sh\n  git-sh-setup: remove unused \"pull with rebase\" message\n  git-bisect: remove unused SHA-1 $x40 shell variable\n  test-lib: remove unused $_x40 and $_z40 variables\n\n contrib/subtree/git-subtree.sh | 12 +++++++++\n git-bisect.sh                  |  2 --\n git-sh-setup.sh                | 45 ----------------------------------\n git-submodule.sh               |  7 +-----\n t/t7006-pager.sh               | 13 ----------\n t/test-lib.sh                  |  6 ++---\n 6 files changed, 15 insertions(+), 70 deletions(-)\n\nRange-diff against v1:\n 1:  2e3ed8061d5 <  -:  ----------- git-sh-setup: remove unused set_reflog_action() function\n 2:  7d3ea928099 <  -:  ----------- git-sh-setup: remove unused git_editor() function\n 3:  73e540896fc !  1:  8eb1dfbff5d git-sh-setup: remove unused git_pager() function\n    @@ Metadata\n      ## Commit message ##\n         git-sh-setup: remove unused git_pager() function\n     \n    -    Remove the git_editor() function last referenced by non-test code code\n    -    in 49eb8d39c78 (Remove contrib/examples/*, 2018-03-25).\n    +    Remove the git_pager() function last referenced by non-test code in\n    +    49eb8d39c78 (Remove contrib/examples/*, 2018-03-25).\n     \n         We can also remove the test for this added in 995bc22d7f8 (pager: move\n         pager-specific setup into the build, 2016-08-04), the test that\n    @@ Commit message\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## git-sh-setup.sh ##\n    -@@ git-sh-setup.sh: $LONG_USAGE\")\"\n    - \tesac\n    - fi\n    +@@ git-sh-setup.sh: git_editor() {\n    + \teval \"$GIT_EDITOR\" '\"$@\"'\n    + }\n      \n     -git_pager() {\n     -\tif test -t 1\n 4:  73f0676db7a =  2:  e7f3115797c git-sh-setup: remove unused sane_egrep() function\n 5:  dc4dd7d1399 <  -:  ----------- git-sh-setup: remove unused require_work_tree_exists() function\n 6:  d2d65f3d77f <  -:  ----------- git-sh-setup: move create_virtual_base() to mergetools/p4merge\n 7:  a3047b93f7d =  3:  d92e880fcfa git-sh-setup: move peel_committish() function to git-subtree.sh\n -:  ----------- >  4:  46c018aa860 git-sh-setup: clear_local_git_env() function to git-submodule.sh\n -:  ----------- >  5:  45c1369e958 git-sh-setup: remove unused \"pull with rebase\" message\n 8:  88dffac9088 =  6:  bcae7884bb0 git-bisect: remove unused SHA-1 $x40 shell variable\n 9:  0fd1516af85 =  7:  479e94f22f4 test-lib: remove unused $_x40 and $_z40 variables\n-- \n2.33.0.821.gfd4106eadbd\n\n"},{"id":"434770","messageId":"patch-v2-1.7-8eb1dfbff5d-20210906T070201Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-v2-0.7-00000000000-20210906T070201Z-avarab@gmail.com","subject":"[PATCH v2 1/7] git-sh-setup: remove unused git_pager() function","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-06T07:05:12Z","receivedAt":"2021-09-06T07:05:31Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the git_pager() function last referenced by non-test code in\n49eb8d39c78 (Remove contrib/examples/*, 2018-03-25).\n\nWe can also remove the test for this added in 995bc22d7f8 (pager: move\npager-specific setup into the build, 2016-08-04), the test that\nactually matters is the one added in e54c1f2d253 (pager: set LV=-c\nalongside LESS=FRSX, 2014-01-06) just above the removed test.\n\nI.e. we don't care if the \"LESS\" and \"LV\" variables are set by\ngit-sh-setup anymore, no built-in uses them, we do care that pager.c\nsets them, which we still test for.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-sh-setup.sh  | 16 ----------------\n t/t7006-pager.sh | 13 -------------\n 2 files changed, 29 deletions(-)\n\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 10d97641856..7ee4b0edff5 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -157,22 +157,6 @@ git_editor() {\n \teval \"$GIT_EDITOR\" '\"$@\"'\n }\n \n-git_pager() {\n-\tif test -t 1\n-\tthen\n-\t\tGIT_PAGER=$(git var GIT_PAGER)\n-\telse\n-\t\tGIT_PAGER=cat\n-\tfi\n-\tfor vardef in @@PAGER_ENV@@\n-\tdo\n-\t\tvar=${vardef%%=*}\n-\t\teval \": \\\"\\${$vardef}\\\" && export $var\"\n-\tdone\n-\n-\teval \"$GIT_PAGER\" '\"$@\"'\n-}\n-\n sane_grep () {\n \tGREP_OPTIONS= LC_ALL=C grep @@SANE_TEXT_GREP@@ \"$@\"\n }\ndiff --git a/t/t7006-pager.sh b/t/t7006-pager.sh\nindex 0e7cf75435e..08f712a4497 100755\n--- a/t/t7006-pager.sh\n+++ b/t/t7006-pager.sh\n@@ -49,19 +49,6 @@ test_expect_success TTY 'LESS and LV envvars are set for pagination' '\n \tgrep ^LV= pager-env.out\n '\n \n-test_expect_success !MINGW,TTY 'LESS and LV envvars set by git-sh-setup' '\n-\t(\n-\t\tsane_unset LESS LV &&\n-\t\tPAGER=\"env >pager-env.out; wc\" &&\n-\t\texport PAGER &&\n-\t\tPATH=\"$(git --exec-path):$PATH\" &&\n-\t\texport PATH &&\n-\t\ttest_terminal sh -c \". git-sh-setup && git_pager\"\n-\t) &&\n-\tgrep ^LESS= pager-env.out &&\n-\tgrep ^LV= pager-env.out\n-'\n-\n test_expect_success TTY 'some commands do not use a pager' '\n \trm -f paginated.out &&\n \ttest_terminal git rev-list HEAD &&\n-- \n2.33.0.821.gfd4106eadbd\n\n"},{"id":"434771","messageId":"patch-v2-5.7-45c1369e958-20210906T070201Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-v2-0.7-00000000000-20210906T070201Z-avarab@gmail.com","subject":"[PATCH v2 5/7] git-sh-setup: remove unused \"pull with rebase\" message","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-06T07:05:16Z","receivedAt":"2021-09-06T07:05:31Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the \"pull with rebase\" message previously used by the\ngit-pull.sh script, which was removed in 49eb8d39c78 (Remove\ncontrib/examples/*, 2018-03-25).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-sh-setup.sh | 6 ------\n 1 file changed, 6 deletions(-)\n\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex b3a97d6455a..acbd05fe25b 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -203,9 +203,6 @@ require_clean_work_tree () {\n \t\t\"rewrite branches\")\n \t\t\tgettextln \"Cannot rewrite branches: You have unstaged changes.\" >&2\n \t\t\t;;\n-\t\t\"pull with rebase\")\n-\t\t\tgettextln \"Cannot pull with rebase: You have unstaged changes.\" >&2\n-\t\t\t;;\n \t\t*)\n \t\t\teval_gettextln \"Cannot \\$action: You have unstaged changes.\" >&2\n \t\t\t;;\n@@ -222,9 +219,6 @@ require_clean_work_tree () {\n \t\t\trebase)\n \t\t\t\tgettextln \"Cannot rebase: Your index contains uncommitted changes.\" >&2\n \t\t\t\t;;\n-\t\t\t\"pull with rebase\")\n-\t\t\t\tgettextln \"Cannot pull with rebase: Your index contains uncommitted changes.\" >&2\n-\t\t\t\t;;\n \t\t\t*)\n \t\t\t\teval_gettextln \"Cannot \\$action: Your index contains uncommitted changes.\" >&2\n \t\t\t\t;;\n-- \n2.33.0.821.gfd4106eadbd\n\n"},{"id":"434772","messageId":"patch-v2-4.7-46c018aa860-20210906T070201Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-v2-0.7-00000000000-20210906T070201Z-avarab@gmail.com","subject":"[PATCH v2 4/7] git-sh-setup: clear_local_git_env() function to git-submodule.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-06T07:05:15Z","receivedAt":"2021-09-06T07:05:34Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Since 14111fc4927 (git: submodule honor -c credential.* from command\nline, 2016-02-29) the clear_local_git_env() function has only been\nused in the sanitize_submodule_env() function, let's inline its\none-line functionality there.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-sh-setup.sh  | 7 -------\n git-submodule.sh | 2 +-\n 2 files changed, 1 insertion(+), 8 deletions(-)\n\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 3fc8830cb36..b3a97d6455a 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -290,13 +290,6 @@ get_author_ident_from_commit () {\n \tparse_ident_from_commit author AUTHOR\n }\n \n-# Clear repo-local GIT_* environment variables. Useful when switching to\n-# another repository (e.g. when entering a submodule). See also the env\n-# list in git_connect()\n-clear_local_git_env() {\n-\tunset $(git rev-parse --local-env-vars)\n-}\n-\n # Generate a virtual base file for a two-file merge. Uses git apply to\n # remove lines from $1 that are not in $2, leaving only common lines.\n create_virtual_base() {\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex aeb96c58243..c9dca58fdaa 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -69,7 +69,7 @@ isnumber()\n sanitize_submodule_env()\n {\n \tsave_config=$GIT_CONFIG_PARAMETERS\n-\tclear_local_git_env\n+\tunset $(git rev-parse --local-env-vars)\n \tGIT_CONFIG_PARAMETERS=$save_config\n \texport GIT_CONFIG_PARAMETERS\n }\n-- \n2.33.0.821.gfd4106eadbd\n\n"},{"id":"434773","messageId":"patch-v2-6.7-bcae7884bb0-20210906T070201Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-v2-0.7-00000000000-20210906T070201Z-avarab@gmail.com","subject":"[PATCH v2 6/7] git-bisect: remove unused SHA-1 $x40 shell variable","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-06T07:05:17Z","receivedAt":"2021-09-06T07:05:35Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This variable was last used in code removed in\n06f5608c14 (bisect--helper: `bisect_start` shell function partially in\nC, 2019-01-02).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-bisect.sh | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 6a7afaea8da..b59f3aaad43 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -34,8 +34,6 @@ Please use \"git help bisect\" to get the full man page.'\n OPTIONS_SPEC=\n . git-sh-setup\n \n-_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n-_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n TERM_BAD=bad\n TERM_GOOD=good\n \n-- \n2.33.0.821.gfd4106eadbd\n\n"},{"id":"434774","messageId":"patch-v2-7.7-479e94f22f4-20210906T070201Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-v2-0.7-00000000000-20210906T070201Z-avarab@gmail.com","subject":"[PATCH v2 7/7] test-lib: remove unused $_x40 and $_z40 variables","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-06T07:05:18Z","receivedAt":"2021-09-06T07:05:37Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"These two have fallen out of use with the SHA-256 migration.\n\nThe last use of $_x40 was removed in fc7e73d7ef (t4013: improve\ndiff-post-processor logic, 2020-08-21) and\n\nThe last use of $_z40 was removed in 7a868c51c2 (t5562: use $ZERO_OID,\n2019-12-21), but it was then needlessly refactored to be hash-agnostic\nin 192b517589 (t: use hash-specific lookup tables to define test\nconstants, 2020-02-22). We can just remove it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex abcfbed6d61..044a9231ae6 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -534,7 +534,7 @@ SQ=\\'\n # when case-folding filenames\n u200c=$(printf '\\342\\200\\214')\n \n-export _x05 _x35 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n+export _x05 _x35 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n \n # Each test should start with something like this, after copyright notices:\n #\n@@ -1422,10 +1422,9 @@ then\n fi\n \n # Convenience\n-# A regexp to match 5, 35 and 40 hexdigits\n+# A regexp to match 5 and 35 hexdigits\n _x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n _x35=\"$_x05$_x05$_x05$_x05$_x05$_x05$_x05\"\n-_x40=\"$_x35$_x05\"\n \n test_oid_init\n \n@@ -1434,7 +1433,6 @@ OID_REGEX=$(echo $ZERO_OID | sed -e 's/0/[0-9a-f]/g')\n OIDPATH_REGEX=$(test_oid_to_path $ZERO_OID | sed -e 's/0/[0-9a-f]/g')\n EMPTY_TREE=$(test_oid empty_tree)\n EMPTY_BLOB=$(test_oid empty_blob)\n-_z40=$ZERO_OID\n \n # Provide an implementation of the 'yes' utility; the upper bound\n # limit is there to help Windows that cannot stop this loop from\n-- \n2.33.0.821.gfd4106eadbd\n\n"},{"id":"434781","messageId":"55293c43-811b-b030-9512-7525f5ebfd12@gmail.com","threadId":"56431","inReplyTo":"patch-v2-1.7-8eb1dfbff5d-20210906T070201Z-avarab@gmail.com","subject":"Re: [PATCH v2 1/7] git-sh-setup: remove unused git_pager() function","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2021-09-06T09:49:36Z","receivedAt":"2021-09-06T09:49:43Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Ævar\n\nOn 06/09/2021 08:05, Ævar Arnfjörð Bjarmason wrote:\n> Remove the git_pager() function last referenced by non-test code in\n> 49eb8d39c78 (Remove contrib/examples/*, 2018-03-25).\n> \n> We can also remove the test for this added in 995bc22d7f8 (pager: move\n> pager-specific setup into the build, 2016-08-04), the test that\n> actually matters is the one added in e54c1f2d253 (pager: set LV=-c\n> alongside LESS=FRSX, 2014-01-06) just above the removed test.\n> \n> I.e. we don't care if the \"LESS\" and \"LV\" variables are set by\n> git-sh-setup anymore, no built-in uses them, we do care that pager.c\n> sets them, which we still test for.\n\ngit_pager() might not be documented but I think it is useful for script \nauthors and I wouldn't be surprised if someone out there is using it. \nThe same goes for peel_committish(). It does not seem like a huge \nmaintenance burden to keep and maybe document these two functions.\n\nBest Wishes\n\nPhillip\n\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>   git-sh-setup.sh  | 16 ----------------\n>   t/t7006-pager.sh | 13 -------------\n>   2 files changed, 29 deletions(-)\n> \n> diff --git a/git-sh-setup.sh b/git-sh-setup.sh\n> index 10d97641856..7ee4b0edff5 100644\n> --- a/git-sh-setup.sh\n> +++ b/git-sh-setup.sh\n> @@ -157,22 +157,6 @@ git_editor() {\n>   \teval \"$GIT_EDITOR\" '\"$@\"'\n>   }\n>   \n> -git_pager() {\n> -\tif test -t 1\n> -\tthen\n> -\t\tGIT_PAGER=$(git var GIT_PAGER)\n> -\telse\n> -\t\tGIT_PAGER=cat\n> -\tfi\n> -\tfor vardef in @@PAGER_ENV@@\n> -\tdo\n> -\t\tvar=${vardef%%=*}\n> -\t\teval \": \\\"\\${$vardef}\\\" && export $var\"\n> -\tdone\n> -\n> -\teval \"$GIT_PAGER\" '\"$@\"'\n> -}\n> -\n>   sane_grep () {\n>   \tGREP_OPTIONS= LC_ALL=C grep @@SANE_TEXT_GREP@@ \"$@\"\n>   }\n> diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh\n> index 0e7cf75435e..08f712a4497 100755\n> --- a/t/t7006-pager.sh\n> +++ b/t/t7006-pager.sh\n> @@ -49,19 +49,6 @@ test_expect_success TTY 'LESS and LV envvars are set for pagination' '\n>   \tgrep ^LV= pager-env.out\n>   '\n>   \n> -test_expect_success !MINGW,TTY 'LESS and LV envvars set by git-sh-setup' '\n> -\t(\n> -\t\tsane_unset LESS LV &&\n> -\t\tPAGER=\"env >pager-env.out; wc\" &&\n> -\t\texport PAGER &&\n> -\t\tPATH=\"$(git --exec-path):$PATH\" &&\n> -\t\texport PATH &&\n> -\t\ttest_terminal sh -c \". git-sh-setup && git_pager\"\n> -\t) &&\n> -\tgrep ^LESS= pager-env.out &&\n> -\tgrep ^LV= pager-env.out\n> -'\n> -\n>   test_expect_success TTY 'some commands do not use a pager' '\n>   \trm -f paginated.out &&\n>   \ttest_terminal git rev-list HEAD &&\n> \n"},{"id":"434806","messageId":"87czplnxn3.fsf@evledraar.gmail.com","threadId":"56431","inReplyTo":"55293c43-811b-b030-9512-7525f5ebfd12@gmail.com","subject":"Re: [PATCH v2 1/7] git-sh-setup: remove unused git_pager() function","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-06T22:27:14Z","receivedAt":"2021-09-06T22:32:23Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Mon, Sep 06 2021, Phillip Wood wrote:\n\n> Hi Ævar\n>\n> On 06/09/2021 08:05, Ævar Arnfjörð Bjarmason wrote:\n>> Remove the git_pager() function last referenced by non-test code in\n>> 49eb8d39c78 (Remove contrib/examples/*, 2018-03-25).\n>> We can also remove the test for this added in 995bc22d7f8 (pager:\n>> move\n>> pager-specific setup into the build, 2016-08-04), the test that\n>> actually matters is the one added in e54c1f2d253 (pager: set LV=-c\n>> alongside LESS=FRSX, 2014-01-06) just above the removed test.\n>> I.e. we don't care if the \"LESS\" and \"LV\" variables are set by\n>> git-sh-setup anymore, no built-in uses them, we do care that pager.c\n>> sets them, which we still test for.\n>\n> git_pager() might not be documented but I think it is useful for\n> script authors and I wouldn't be surprised if someone out there is\n> using it. The same goes for peel_committish(). It does not seem like a\n> huge maintenance burden to keep and maybe document these two\n> functions.\n\nThe git_pager() and peel_committish() seem to thoroughly be in the same\ncamp as the now-removed git-parse-remote.sh (see a89a2fbfccd\n(parse-remote: remove this now-unused library, 2020-11-14)) and say its\nget_remote_merge_branch(). I.e. we carried it for a while, but the\nfunction was never publicly documented.\n\nI think rather than document these it makes sense to just kick that\nmaintenance burden over to whoever decided they'd rely on undocumented\nshellscript functions git was shipping.\n\nIn these cases they can rather easily use the documented GIT_PAGER\nenvironment variable directly, and their own invocation of \"git\nrev-parse\" for peel_committish().\n"},{"id":"434822","messageId":"8912317f-7eb0-edae-29e3-2e05099bc696@gmail.com","threadId":"56431","inReplyTo":"87czplnxn3.fsf@evledraar.gmail.com","subject":"Re: [PATCH v2 1/7] git-sh-setup: remove unused git_pager() function","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2021-09-07T09:41:24Z","receivedAt":"2021-09-07T09:41:39Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 06/09/2021 23:27, Ævar Arnfjörð Bjarmason wrote:\n> \n> On Mon, Sep 06 2021, Phillip Wood wrote:\n> \n>> Hi Ævar\n>>\n>> On 06/09/2021 08:05, Ævar Arnfjörð Bjarmason wrote:\n>>> Remove the git_pager() function last referenced by non-test code in\n>>> 49eb8d39c78 (Remove contrib/examples/*, 2018-03-25).\n>>> We can also remove the test for this added in 995bc22d7f8 (pager:\n>>> move\n>>> pager-specific setup into the build, 2016-08-04), the test that\n>>> actually matters is the one added in e54c1f2d253 (pager: set LV=-c\n>>> alongside LESS=FRSX, 2014-01-06) just above the removed test.\n>>> I.e. we don't care if the \"LESS\" and \"LV\" variables are set by\n>>> git-sh-setup anymore, no built-in uses them, we do care that pager.c\n>>> sets them, which we still test for.\n>>\n>> git_pager() might not be documented but I think it is useful for\n>> script authors and I wouldn't be surprised if someone out there is\n>> using it. The same goes for peel_committish(). It does not seem like a\n>> huge maintenance burden to keep and maybe document these two\n>> functions.\n> \n> The git_pager() and peel_committish() seem to thoroughly be in the same\n> camp as the now-removed git-parse-remote.sh (see a89a2fbfccd\n> (parse-remote: remove this now-unused library, 2020-11-14)) and say its\n> get_remote_merge_branch(). I.e. we carried it for a while, but the\n> function was never publicly documented.\n> \n> I think rather than document these it makes sense to just kick that\n> maintenance burden over to whoever decided they'd rely on undocumented\n> shellscript functions git was shipping.\n> \n> In these cases they can rather easily use the documented GIT_PAGER\n> environment variable directly, \n\nNo, they need to know to call 'git var GIT_PAGER' rather than using the \nenvironment variable directly to pick up core.pager and they should be \nchecking whether stdout is a tty. That is why this function existed and \nwe didn't just check the value of GIT_PAGER in our scripts\n\n> and their own invocation of \"git rev-parse\" for peel_committish().\n\nThe reason the function exists is that you cannot just call 'git \nrev-parse $OID^{commit}' if $OID starts with :/\n\nI'm not sure what the maintenance burden of keeping these functions is \nthat makes it worth removing them\n\nBest Wishes\n\nPhillip\n\n"},{"id":"434824","messageId":"87eea0n04u.fsf@evledraar.gmail.com","threadId":"56431","inReplyTo":"8912317f-7eb0-edae-29e3-2e05099bc696@gmail.com","subject":"Re: [PATCH v2 1/7] git-sh-setup: remove unused git_pager() function","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-07T10:22:58Z","receivedAt":"2021-09-07T10:36:08Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Sep 07 2021, Phillip Wood wrote:\n\n> On 06/09/2021 23:27, Ævar Arnfjörð Bjarmason wrote:\n>> On Mon, Sep 06 2021, Phillip Wood wrote:\n>> \n>>> Hi Ævar\n>>>\n>>> On 06/09/2021 08:05, Ævar Arnfjörð Bjarmason wrote:\n>>>> Remove the git_pager() function last referenced by non-test code in\n>>>> 49eb8d39c78 (Remove contrib/examples/*, 2018-03-25).\n>>>> We can also remove the test for this added in 995bc22d7f8 (pager:\n>>>> move\n>>>> pager-specific setup into the build, 2016-08-04), the test that\n>>>> actually matters is the one added in e54c1f2d253 (pager: set LV=-c\n>>>> alongside LESS=FRSX, 2014-01-06) just above the removed test.\n>>>> I.e. we don't care if the \"LESS\" and \"LV\" variables are set by\n>>>> git-sh-setup anymore, no built-in uses them, we do care that pager.c\n>>>> sets them, which we still test for.\n>>>\n>>> git_pager() might not be documented but I think it is useful for\n>>> script authors and I wouldn't be surprised if someone out there is\n>>> using it. The same goes for peel_committish(). It does not seem like a\n>>> huge maintenance burden to keep and maybe document these two\n>>> functions.\n>> The git_pager() and peel_committish() seem to thoroughly be in the\n>> same\n>> camp as the now-removed git-parse-remote.sh (see a89a2fbfccd\n>> (parse-remote: remove this now-unused library, 2020-11-14)) and say its\n>> get_remote_merge_branch(). I.e. we carried it for a while, but the\n>> function was never publicly documented.\n>> I think rather than document these it makes sense to just kick that\n>> maintenance burden over to whoever decided they'd rely on undocumented\n>> shellscript functions git was shipping.\n>> In these cases they can rather easily use the documented GIT_PAGER\n>> environment variable directly, \n>\n> No, they need to know to call 'git var GIT_PAGER' rather than using\n> the environment variable directly to pick up core.pager[...]\n\nSorry, I should have said \"...directly via git var GIT_PAGER\". I also\nsee that we could improve some of the doc cross-referencing here,\ni.e. \"git help git\") doesn't make this explicit or point to \"git var\",\nbut we cover this in \"git help var\" itself.\n\n> [...]should be checking whether stdout is a tty. That is why this function\n> existed and we didn't just check the value of GIT_PAGER in our scripts\n\nFor a hypothetical out-of-tree user is this really something anyone\nstrictly needs? It's just an optimization. If you don't do it you'll\njust use your pager to pipe output to a non-tty.\n\n>> and their own invocation of \"git rev-parse\" for peel_committish().\n>\n> The reason the function exists is that you cannot just call 'git\n> rev-parse $OID^{commit}' if $OID starts with :/\n\nSure, but is the answer to that & the pager case above that we need to\nsupport an always-undocumented function that someone could only have\nfound via source spelunking, as opposed to them maintaining that case,\nor submitting a patch to \"git rev-parse\" to make their use-case easier?\n\n> I'm not sure what the maintenance burden of keeping these functions is\n> that makes it worth removing them\n\nI was hoping that we could head towards just entirely removing\ngit-sh-setup in the near-ish future, but per the evolution of this\nseries it seems that we've got out-of-tree users for its *documented*\nfunctions, so we can't simply do that.\n\nI would like to be able to rip out the shellscript support for i18n\nsooner than later, I think a way to get there would be to only emit\nstrings in the C locale from these remaining git-sh-setup functions, and\neventually move that script to live in contrib/ or something (and be\nable to install it). I.e. make it a backwards-compatability-only\ninterface.\n\nSo yes, the maintenance burden of any two functions being removed here\nis trivial and we could just keep them around.\n\nI'm pursuing this because I'd really like to get clarity on where\nexactly we're drawing the line with this git-sh-setup interface, since\nwe can anticipate a near-future where our own remaining user won't use\nit anymore (or the 1-2 things they do can be moved to\ngit-filter-branch.sh or whatever).\n\nThe burden of that *is* non-trivial. I.e. us having to project gettext\nto shellscript land, which in turn is something that's kept me from\nimproving git's i18n interface, i.e. provide some light alternative to\nit that won't require libintl, as long as I've got to support that sort\nof thing in shellscript land...\n\nDo you have out-of-tree uses of git_pager(), or do we know about anyone\nwho does? I understand the argument that we've documented certain things\nin git-sh-setup for years, but needing to support what's amounted to an\nundocumented internal implementation detail seems like it's going too\nfar.\n"},{"id":"434910","messageId":"xmqqh7ewb5a8.fsf@gitster.g","threadId":"56431","inReplyTo":"87eea0n04u.fsf@evledraar.gmail.com","subject":"Re: [PATCH v2 1/7] git-sh-setup: remove unused git_pager() function","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-09-07T18:37:51Z","receivedAt":"2021-09-07T18:37:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n>> No, they need to know to call 'git var GIT_PAGER' rather than using\n>> the environment variable directly to pick up core.pager[...]\n>\n> Sorry, I should have said \"...directly via git var GIT_PAGER\". I also\n> see that we could improve some of the doc cross-referencing here,\n> i.e. \"git help git\") doesn't make this explicit or point to \"git var\",\n> but we cover this in \"git help var\" itself.\n>\n>> [...]should be checking whether stdout is a tty. That is why this function\n>> existed and we didn't just check the value of GIT_PAGER in our scripts\n>\n> For a hypothetical out-of-tree user is this really something anyone\n> strictly needs? It's just an optimization. If you don't do it you'll\n> just use your pager to pipe output to a non-tty.\n\nThe question we should be asking when we advocate to remove things\nis \"is this really something we absolutely cannot live with?\"\n\nBut answering your question, if an out-of-tree user wants to behave\njust like Git, pretending that it would have been part of Git and\nthe only reason why it is not is because it weren't invented here,\nyes, not forcing the end-user to pipe the tool's output to pager is\nsomething they would want to have a handy way to mimic, I would\nthink.\n\nThanks.\n"},{"id":"434928","messageId":"87tuiwjfvi.fsf@evledraar.gmail.com","threadId":"56431","inReplyTo":"xmqqh7ewb5a8.fsf@gitster.g","subject":"Re: [PATCH v2 1/7] git-sh-setup: remove unused git_pager() function","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-07T19:58:11Z","receivedAt":"2021-09-07T20:21:57Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Sep 07 2021, Junio C Hamano wrote:\n\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>\n>>> No, they need to know to call 'git var GIT_PAGER' rather than using\n>>> the environment variable directly to pick up core.pager[...]\n>>\n>> Sorry, I should have said \"...directly via git var GIT_PAGER\". I also\n>> see that we could improve some of the doc cross-referencing here,\n>> i.e. \"git help git\") doesn't make this explicit or point to \"git var\",\n>> but we cover this in \"git help var\" itself.\n>>\n>>> [...]should be checking whether stdout is a tty. That is why this function\n>>> existed and we didn't just check the value of GIT_PAGER in our scripts\n>>\n>> For a hypothetical out-of-tree user is this really something anyone\n>> strictly needs? It's just an optimization. If you don't do it you'll\n>> just use your pager to pipe output to a non-tty.\n>\n> The question we should be asking when we advocate to remove things\n> is \"is this really something we absolutely cannot live with?\"\n>\n> But answering your question, if an out-of-tree user wants to behave\n> just like Git, pretending that it would have been part of Git and\n> the only reason why it is not is because it weren't invented here,\n> yes, not forcing the end-user to pipe the tool's output to pager is\n> something they would want to have a handy way to mimic, I would\n> think.\n\nI've made my preferences clear, but can live with whatever criteria we\ncome up with.\n\nI am having trouble squaring the desire to keep git_pager() with the\nview you're describing, unless it's also an implicit endorsement of\nreverting a89a2fbfccd (parse-remote: remove this now-unused library,\n2020-11-14).\n\nI'd obviously prefer to see git-parse-remote stay gone. But if we're\nworried about removing once-documented \"git-sh-*\" libraries from under\nusers who peeked under the hood at some point to see & use functions\nwithin them, I'd think bringing back \"git-parse-remote\" would be more\nlikely to help those users than having a git_pager().\n\nAnd once we're rid of all our own use of these libraries but still want\nto ship them forever for such users, I'd think we'd want to bring some\nversion of a revert of 49eb8d39c78 (Remove contrib/examples/*,\n2018-03-25) back, i.e. just to make sure we don't break these going\nforward, as once our own use of them is removed they'll be completely\nuntested in-tree.\n\nAnyway, as noted in <87eea0n04u.fsf@evledraar.gmail.com> I was hoping to\ntake a small step towards finishing up removing the libintl dependency.\nBut after this discussion I think I'm back to mentally classifying that\nas too tedious of a task to even try, so I wouldn't mind dropping this\nseries of cleanups if we've landed on a consensus of keeping\ngit-sh-setup bug-for-bug compatible going forward, and by extension\ngit-sh-i18n.\n"},{"id":"435543","messageId":"patch-v3-2.4-db7223741ec-20210911T111435Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-v3-0.4-00000000000-20210911T111435Z-avarab@gmail.com","subject":"[PATCH v3 2/4] git-sh-setup: remove unused \"pull with rebase\" message","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-11T11:17:49Z","receivedAt":"2021-09-11T11:21:27Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the \"pull with rebase\" message previously used by the\ngit-pull.sh script, which was removed in 49eb8d39c78 (Remove\ncontrib/examples/*, 2018-03-25).\n\nEven if some out-of-tree user copy/pasted the old git-pull.sh code,\nand relied on passing it a \"pull with rebase\" argument, we'll fall\nback on the \"*\" case here, they just won't get the \"pull with rebase\"\npart of their message translated.\n\nI don't think it's likely that anyone out-of-tree relied on that, but\nI'm being conservative here per the discussion that can be found\nupthread of [1].\n\n1. https://lore.kernel.org/git/87tuiwjfvi.fsf@evledraar.gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-sh-setup.sh | 6 ------\n 1 file changed, 6 deletions(-)\n\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 10d97641856..cee053cdc38 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -223,9 +223,6 @@ require_clean_work_tree () {\n \t\t\"rewrite branches\")\n \t\t\tgettextln \"Cannot rewrite branches: You have unstaged changes.\" >&2\n \t\t\t;;\n-\t\t\"pull with rebase\")\n-\t\t\tgettextln \"Cannot pull with rebase: You have unstaged changes.\" >&2\n-\t\t\t;;\n \t\t*)\n \t\t\teval_gettextln \"Cannot \\$action: You have unstaged changes.\" >&2\n \t\t\t;;\n@@ -242,9 +239,6 @@ require_clean_work_tree () {\n \t\t\trebase)\n \t\t\t\tgettextln \"Cannot rebase: Your index contains uncommitted changes.\" >&2\n \t\t\t\t;;\n-\t\t\t\"pull with rebase\")\n-\t\t\t\tgettextln \"Cannot pull with rebase: Your index contains uncommitted changes.\" >&2\n-\t\t\t\t;;\n \t\t\t*)\n \t\t\t\teval_gettextln \"Cannot \\$action: Your index contains uncommitted changes.\" >&2\n \t\t\t\t;;\n-- \n2.33.0.984.gea2c3555113\n\n"},{"id":"435544","messageId":"cover-v3-0.4-00000000000-20210911T111435Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-v2-0.7-00000000000-20210906T070201Z-avarab@gmail.com","subject":"[PATCH v3 0/4] remove dead & internal-only shell code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-11T11:17:47Z","receivedAt":"2021-09-11T11:21:27Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Per the discussion on v1 and v2 I've reduced the size of this series\nto only those changes that should be uncontroversial to remove, even\nby the harshest standards of maintaining compatibility with\nout-of-tree users of undocumented functions in git's shell libraries.\n\nNow we remove is_zero_oid() from git-submodule.sh, but not the\nsane_egrep() from git-sh-setup.sh, git_pager() also stays, so does\npeel_committish() and clear_local_git_env().\n\nI think we can keep 2/4 ad remove the \"pull with rebase\" message,\nsince as noted there the worst case is that someone will lose only\nthat part of their translation.\n\nAnd finally, the 3/4 and 4/4 are the same cleanups of internal-only or\ntest-only OID-matching variables as before.\n\nÆvar Arnfjörð Bjarmason (4):\n  git-submodule: remove unused is_zero_oid() function\n  git-sh-setup: remove unused \"pull with rebase\" message\n  git-bisect: remove unused SHA-1 $x40 shell variable\n  test-lib: remove unused $_x40 and $_z40 variables\n\n git-bisect.sh    | 2 --\n git-sh-setup.sh  | 6 ------\n git-submodule.sh | 5 -----\n t/test-lib.sh    | 6 ++----\n 4 files changed, 2 insertions(+), 17 deletions(-)\n\nRange-diff against v2:\n1:  8eb1dfbff5d < -:  ----------- git-sh-setup: remove unused git_pager() function\n2:  e7f3115797c ! 1:  62b3a5881c9 git-sh-setup: remove unused sane_egrep() function\n    @@ Metadata\n     Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## Commit message ##\n    -    git-sh-setup: remove unused sane_egrep() function\n    +    git-submodule: remove unused is_zero_oid() function\n     \n         The is_zero_oid() function in git-submodule.sh has not been used since\n         e83e3333b57 (submodule: port submodule subcommand 'summary' from shell\n    -    to C, 2020-08-13), so we can remove it, and the sane_egrep() function,\n    -    dead is_zero_oid() was the only function which still referenced it.\n    +    to C, 2020-08-13), so we can remove it.\n     \n    -    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n    +    This was the last user of the sane_egrep() function in\n    +    git-sh-setup.sh. I'm not removing it in case some out-of-tree user\n    +    relied on it. Per the discussion that can be found upthread of [1].\n     \n    - ## git-sh-setup.sh ##\n    -@@ git-sh-setup.sh: sane_grep () {\n    - \tGREP_OPTIONS= LC_ALL=C grep @@SANE_TEXT_GREP@@ \"$@\"\n    - }\n    - \n    --sane_egrep () {\n    --\tGREP_OPTIONS= LC_ALL=C egrep @@SANE_TEXT_GREP@@ \"$@\"\n    --}\n    --\n    - is_bare_repository () {\n    - \tgit rev-parse --is-bare-repository\n    - }\n    +    1. https://lore.kernel.org/git/87tuiwjfvi.fsf@evledraar.gmail.com/\n    +\n    +    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## git-submodule.sh ##\n     @@ git-submodule.sh: isnumber()\n3:  d92e880fcfa < -:  ----------- git-sh-setup: move peel_committish() function to git-subtree.sh\n4:  46c018aa860 < -:  ----------- git-sh-setup: clear_local_git_env() function to git-submodule.sh\n5:  45c1369e958 ! 2:  db7223741ec git-sh-setup: remove unused \"pull with rebase\" message\n    @@ Commit message\n         git-pull.sh script, which was removed in 49eb8d39c78 (Remove\n         contrib/examples/*, 2018-03-25).\n     \n    +    Even if some out-of-tree user copy/pasted the old git-pull.sh code,\n    +    and relied on passing it a \"pull with rebase\" argument, we'll fall\n    +    back on the \"*\" case here, they just won't get the \"pull with rebase\"\n    +    part of their message translated.\n    +\n    +    I don't think it's likely that anyone out-of-tree relied on that, but\n    +    I'm being conservative here per the discussion that can be found\n    +    upthread of [1].\n    +\n    +    1. https://lore.kernel.org/git/87tuiwjfvi.fsf@evledraar.gmail.com/\n    +\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## git-sh-setup.sh ##\n6:  bcae7884bb0 = 3:  cc2059f09f1 git-bisect: remove unused SHA-1 $x40 shell variable\n7:  479e94f22f4 = 4:  206519c2d34 test-lib: remove unused $_x40 and $_z40 variables\n-- \n2.33.0.984.gea2c3555113\n\n"},{"id":"435545","messageId":"patch-v3-1.4-62b3a5881c9-20210911T111435Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-v3-0.4-00000000000-20210911T111435Z-avarab@gmail.com","subject":"[PATCH v3 1/4] git-submodule: remove unused is_zero_oid() function","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-11T11:17:48Z","receivedAt":"2021-09-11T11:21:27Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The is_zero_oid() function in git-submodule.sh has not been used since\ne83e3333b57 (submodule: port submodule subcommand 'summary' from shell\nto C, 2020-08-13), so we can remove it.\n\nThis was the last user of the sane_egrep() function in\ngit-sh-setup.sh. I'm not removing it in case some out-of-tree user\nrelied on it. Per the discussion that can be found upthread of [1].\n\n1. https://lore.kernel.org/git/87tuiwjfvi.fsf@evledraar.gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-submodule.sh | 5 -----\n 1 file changed, 5 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex dbd2ec20503..aeb96c58243 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -63,11 +63,6 @@ isnumber()\n \tn=$(($1 + 0)) 2>/dev/null && test \"$n\" = \"$1\"\n }\n \n-# Given a full hex object ID, is this the zero OID?\n-is_zero_oid () {\n-\techo \"$1\" | sane_egrep '^0+$' >/dev/null 2>&1\n-}\n-\n # Sanitize the local git environment for use within a submodule. We\n # can't simply use clear_local_git_env since we want to preserve some\n # of the settings from GIT_CONFIG_PARAMETERS.\n-- \n2.33.0.984.gea2c3555113\n\n"},{"id":"435546","messageId":"patch-v3-3.4-cc2059f09f1-20210911T111435Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-v3-0.4-00000000000-20210911T111435Z-avarab@gmail.com","subject":"[PATCH v3 3/4] git-bisect: remove unused SHA-1 $x40 shell variable","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-11T11:17:50Z","receivedAt":"2021-09-11T11:21:27Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This variable was last used in code removed in\n06f5608c14 (bisect--helper: `bisect_start` shell function partially in\nC, 2019-01-02).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-bisect.sh | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 6a7afaea8da..b59f3aaad43 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -34,8 +34,6 @@ Please use \"git help bisect\" to get the full man page.'\n OPTIONS_SPEC=\n . git-sh-setup\n \n-_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n-_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n TERM_BAD=bad\n TERM_GOOD=good\n \n-- \n2.33.0.984.gea2c3555113\n\n"},{"id":"435547","messageId":"patch-v3-4.4-206519c2d34-20210911T111435Z-avarab@gmail.com","threadId":"56431","inReplyTo":"cover-v3-0.4-00000000000-20210911T111435Z-avarab@gmail.com","subject":"[PATCH v3 4/4] test-lib: remove unused $_x40 and $_z40 variables","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-11T11:17:51Z","receivedAt":"2021-09-11T11:21:27Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"These two have fallen out of use with the SHA-256 migration.\n\nThe last use of $_x40 was removed in fc7e73d7ef (t4013: improve\ndiff-post-processor logic, 2020-08-21) and\n\nThe last use of $_z40 was removed in 7a868c51c2 (t5562: use $ZERO_OID,\n2019-12-21), but it was then needlessly refactored to be hash-agnostic\nin 192b517589 (t: use hash-specific lookup tables to define test\nconstants, 2020-02-22). We can just remove it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex fc1e5215198..a0b944e8feb 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -534,7 +534,7 @@ SQ=\\'\n # when case-folding filenames\n u200c=$(printf '\\342\\200\\214')\n \n-export _x05 _x35 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n+export _x05 _x35 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX\n \n # Each test should start with something like this, after copyright notices:\n #\n@@ -1423,10 +1423,9 @@ then\n fi\n \n # Convenience\n-# A regexp to match 5, 35 and 40 hexdigits\n+# A regexp to match 5 and 35 hexdigits\n _x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n _x35=\"$_x05$_x05$_x05$_x05$_x05$_x05$_x05\"\n-_x40=\"$_x35$_x05\"\n \n test_oid_init\n \n@@ -1435,7 +1434,6 @@ OID_REGEX=$(echo $ZERO_OID | sed -e 's/0/[0-9a-f]/g')\n OIDPATH_REGEX=$(test_oid_to_path $ZERO_OID | sed -e 's/0/[0-9a-f]/g')\n EMPTY_TREE=$(test_oid empty_tree)\n EMPTY_BLOB=$(test_oid empty_blob)\n-_z40=$ZERO_OID\n \n # Provide an implementation of the 'yes' utility; the upper bound\n # limit is there to help Windows that cannot stop this loop from\n-- \n2.33.0.984.gea2c3555113\n\n"},{"id":"435682","messageId":"xmqqr1dtgnn8.fsf@gitster.g","threadId":"56431","inReplyTo":"patch-v3-1.4-62b3a5881c9-20210911T111435Z-avarab@gmail.com","subject":"Re: [PATCH v3 1/4] git-submodule: remove unused is_zero_oid() function","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-09-13T03:28:11Z","receivedAt":"2021-09-13T03:28:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> The is_zero_oid() function in git-submodule.sh has not been used since\n> e83e3333b57 (submodule: port submodule subcommand 'summary' from shell\n> to C, 2020-08-13), so we can remove it.\n>\n> This was the last user of the sane_egrep() function in\n> git-sh-setup.sh. I'm not removing it in case some out-of-tree user\n> relied on it. Per the discussion that can be found upthread of [1].\n\nI am OK with losing sane_egrep because it is not about a usefulness\nwe can give to our users based on our deep knowledge on how Git works;\nit was rather based on our experience having to deal with silly choice\nGNU grep made about coloring that made it unpleasant to use in scripts.\nThe users shouldn't have to depend on us for such a thing.\n\nBut I am OK either way---the whole topic is more or less \"Meh\" to\nme.  It is hard to draw a line between a collection of pointless\nchurn and a generally useful clean-up, and I am having a hard time\ndeciding which side of the boundary this falls.\n\n"}]}