{"thread":{"id":"56580","subject":"Wrong option -h in grep, ls-remote, and show-ref.","startedAt":"2021-09-24T14:35:24Z","lastAt":"2021-09-24T21:21:39Z","messageCount":12,"participants":["Ignacy Gawedzki","Ævar Arnfjörð Bjarmason","SZEDER Gábor","Jeff King","Junio C Hamano","René Scharfe"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"436950","messageId":"20210924141920.ezfpyf4uutob2h5z@zenon.in.qult.net","threadId":"56580","inReplyTo":null,"subject":"Wrong option -h in grep, ls-remote, and show-ref.","fromName":"Ignacy Gawedzki","fromEmail":"ignacy.gawedzki@green-communications.fr","sentAt":"2021-09-24T14:19:20Z","receivedAt":"2021-09-24T14:35:24Z","isPatch":false,"sender":{"key":"ignacy.gawedzki@green-communications.fr","avatar":null},"body":"Thank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\ngit ls-remote -h\n\nWhat did you expect to happen? (Expected behavior)\n\nThe same as git ls-remote --heads.\n\nWhat happened instead? (Actual behavior)\n\nDisplayed the git ls-remote usage.\n\nWhat's different between what you expected and what actually happened?\n\nThe usage indicates -h is the same as --heads, while -h is handled\nupstream and always displays the usage of the command.\n\nAnything else you want to add:\n\nThe same problem exists with the following commands:\n\n  grep -h is supposed to not show filenames according to its usage string.\n  show-ref -h is defined as some hidden option equivalent to --head.\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.30.2\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Linux 5.11.0-31-lowlatency #33-Ubuntu SMP PREEMPT Wed Aug 11 14:21:21 UTC 2021 x86_64\ncompiler info: gnuc: 10.2\nlibc info: glibc: 2.33\n$SHELL (typically, interactive shell): /bin/zsh\n\n\n[Enabled Hooks]\nnot run from a git repository - no hooks to show\n"},{"id":"436974","messageId":"cover-0.3-00000000000-20210924T164820Z-avarab@gmail.com","threadId":"56580","inReplyTo":"20210924141920.ezfpyf4uutob2h5z@zenon.in.qult.net","subject":"[PATCH 0/3] show-ref, ls-remote, grep: fix -h handling","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-24T16:51:43Z","receivedAt":"2021-09-24T16:51:52Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This fixes the issues reported at\nhttp://lore.kernel.org/git/20210924141920.ezfpyf4uutob2h5z@zenon.in.qult.net,\nthanks to Ignacy Gawedzki for the report!\n\nÆvar Arnfjörð Bjarmason (3):\n  show-ref: remove unused custom handling of -h\n  ls-remote: remove documentation for custom -h option\n  grep: pass PARSE_OPT_NO_INTERNAL_HELP, fix odd -h handling\n\n Documentation/git-ls-remote.txt | 1 -\n builtin/grep.c                  | 3 ++-\n builtin/ls-remote.c             | 2 +-\n builtin/show-ref.c              | 2 --\n t/t0012-help.sh                 | 4 +++-\n t/t7810-grep.sh                 | 4 ++++\n 6 files changed, 10 insertions(+), 6 deletions(-)\n\n-- \n2.33.0.1285.g7aff81f6560\n\n"},{"id":"436975","messageId":"patch-1.3-c79a3907a27-20210924T164820Z-avarab@gmail.com","threadId":"56580","inReplyTo":"cover-0.3-00000000000-20210924T164820Z-avarab@gmail.com","subject":"[PATCH 1/3] show-ref: remove unused custom handling of -h","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-24T16:51:44Z","receivedAt":"2021-09-24T16:51:54Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Since b92891f9783 (parseopt: add PARSE_OPT_NO_INTERNAL_HELP,\n2009-03-08) parse_options() has handled \"-h\" unless told not to, so\nwhen show-ref was migrated to parse_options() in\n69932bc6117 (show-ref: migrate to parse-options, 2009-06-20) the\ncustom \"-h\" handling that was retained did nothing.\n\nThe option was then hidden in e62b3935056 (Show usage string for 'git\nshow-ref -h', 2009-11-09), but that OPT_BOOLEAN didn't do\nanything. Let's just remove this dead code.\n\nReported-by: Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/show-ref.c | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/builtin/show-ref.c b/builtin/show-ref.c\nindex 7f8a5332f83..8cefb663282 100644\n--- a/builtin/show-ref.c\n+++ b/builtin/show-ref.c\n@@ -163,8 +163,6 @@ static const struct option show_ref_options[] = {\n \tOPT_BOOL(0, \"heads\", &heads_only, N_(\"only show heads (can be combined with tags)\")),\n \tOPT_BOOL(0, \"verify\", &verify, N_(\"stricter reference checking, \"\n \t\t    \"requires exact ref path\")),\n-\tOPT_HIDDEN_BOOL('h', NULL, &show_head,\n-\t\t\tN_(\"show the HEAD reference, even if it would be filtered out\")),\n \tOPT_BOOL(0, \"head\", &show_head,\n \t  N_(\"show the HEAD reference, even if it would be filtered out\")),\n \tOPT_BOOL('d', \"dereference\", &deref_tags,\n-- \n2.33.0.1285.g7aff81f6560\n\n"},{"id":"436976","messageId":"patch-2.3-32b8dbecfe0-20210924T164820Z-avarab@gmail.com","threadId":"56580","inReplyTo":"cover-0.3-00000000000-20210924T164820Z-avarab@gmail.com","subject":"[PATCH 2/3] ls-remote: remove documentation for custom -h option","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-24T16:51:45Z","receivedAt":"2021-09-24T16:51:54Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The custom handling of the \"-h\" option was broken in\nba5f28bf79e (ls-remote: use parse-options api, 2016-01-19), first\nreleased with Git v2.8.0. We've been promising that it's a synonym of\n--head, but it's not.\n\nWe could make this work again by supplying the\nPARSE_OPT_NO_INTERNAL_HELP flag to parse_options(), but if we were\nwriting this command today we wouldn't make this an exception. Since\nit's been such a long time let's just remove this rather than\nrestoring the exception to \"-h\" handling.\n\nReported-by: Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Documentation/git-ls-remote.txt | 1 -\n builtin/ls-remote.c             | 2 +-\n 2 files changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt\nindex 492e573856f..6e241640bd9 100644\n--- a/Documentation/git-ls-remote.txt\n+++ b/Documentation/git-ls-remote.txt\n@@ -21,7 +21,6 @@ commit IDs.\n \n OPTIONS\n -------\n--h::\n --heads::\n -t::\n --tags::\ndiff --git a/builtin/ls-remote.c b/builtin/ls-remote.c\nindex f4fd823af83..c5e68918b78 100644\n--- a/builtin/ls-remote.c\n+++ b/builtin/ls-remote.c\n@@ -64,7 +64,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)\n \t\t\t   N_(\"path of git-upload-pack on the remote host\"),\n \t\t\t   PARSE_OPT_HIDDEN },\n \t\tOPT_BIT('t', \"tags\", &flags, N_(\"limit to tags\"), REF_TAGS),\n-\t\tOPT_BIT('h', \"heads\", &flags, N_(\"limit to heads\"), REF_HEADS),\n+\t\tOPT_BIT(0, \"heads\", &flags, N_(\"limit to heads\"), REF_HEADS),\n \t\tOPT_BIT(0, \"refs\", &flags, N_(\"do not show peeled tags\"), REF_NORMAL),\n \t\tOPT_BOOL(0, \"get-url\", &get_url,\n \t\t\t N_(\"take url.<base>.insteadOf into account\")),\n-- \n2.33.0.1285.g7aff81f6560\n\n"},{"id":"436977","messageId":"patch-3.3-996f3dae2a7-20210924T164820Z-avarab@gmail.com","threadId":"56580","inReplyTo":"cover-0.3-00000000000-20210924T164820Z-avarab@gmail.com","subject":"[PATCH 3/3] grep: pass PARSE_OPT_NO_INTERNAL_HELP, fix odd -h handling","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-24T16:51:46Z","receivedAt":"2021-09-24T16:51:56Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The \"grep\" command supports both \"-h\" and \"-H\" options, along with a\nmandatory pattern, but this has been partially usurped by the \"-h\"\nhandling in parse_options().\n\nThe reason it's just been \"odd\" instead of a bug is that we'll only\nprint out \"-h\" usage with parse_options() if there's no further\nnon-option arguments, so instead of printing this brief blurb on a\nstand-alone -h we'd print out the full usage:\n\n    $ git grep -H\n    fatal: no pattern given\n\nBut for the aforementioned reason a \"git grep -h <pattern>\" would\nwork, we wouldn't take the !PARSE_OPT_NO_INTERNAL_HELP branch in\nparse_options_step(), would handle our own custom 'h' option, and\nbuiltin/grep.c itself would know what to do at that point.\n\nReported-by: Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/grep.c  | 3 ++-\n t/t0012-help.sh | 4 +++-\n t/t7810-grep.sh | 4 ++++\n 3 files changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 51278b01fa2..a2d6704aa41 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -981,7 +981,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \t */\n \targc = parse_options(argc, argv, prefix, options, grep_usage,\n \t\t\t     PARSE_OPT_KEEP_DASHDASH |\n-\t\t\t     PARSE_OPT_STOP_AT_NON_OPTION);\n+\t\t\t     PARSE_OPT_STOP_AT_NON_OPTION |\n+\t\t\t     PARSE_OPT_NO_INTERNAL_HELP);\n \tgrep_commit_pattern_type(pattern_type_arg, &opt);\n \n \tif (use_index && !startup_info->have_repository) {\ndiff --git a/t/t0012-help.sh b/t/t0012-help.sh\nindex 913f34c8e9d..0b623fe794a 100755\n--- a/t/t0012-help.sh\n+++ b/t/t0012-help.sh\n@@ -90,7 +90,9 @@ test_expect_success 'git help succeeds without git.html' '\n '\n \n test_expect_success 'generate builtin list' '\n-\tgit --list-cmds=builtins >builtins\n+\tgit --list-cmds=builtins >builtins &&\n+\tgrep -v \"^grep$\" builtins >builtins+ &&\n+\tmv builtins+ builtins\n '\n \n while read builtin\ndiff --git a/t/t7810-grep.sh b/t/t7810-grep.sh\nindex 6b6423a07c3..4c2777120b0 100755\n--- a/t/t7810-grep.sh\n+++ b/t/t7810-grep.sh\n@@ -11,6 +11,10 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n \n . ./test-lib.sh\n \n+test_expect_success 'usage' '\n+\ttest_expect_code 128 git grep -h\n+'\n+\n test_invalid_grep_expression() {\n \tparams=\"$@\" &&\n \ttest_expect_success \"invalid expression: grep $params\" '\n-- \n2.33.0.1285.g7aff81f6560\n\n"},{"id":"436979","messageId":"20210924171113.GA3311029@szeder.dev","threadId":"56580","inReplyTo":"patch-2.3-32b8dbecfe0-20210924T164820Z-avarab@gmail.com","subject":"Re: [PATCH 2/3] ls-remote: remove documentation for custom -h option","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2021-09-24T17:11:13Z","receivedAt":"2021-09-24T17:11:23Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Fri, Sep 24, 2021 at 06:51:45PM +0200, Ævar Arnfjörð Bjarmason wrote:\n> The custom handling of the \"-h\" option was broken in\n> ba5f28bf79e (ls-remote: use parse-options api, 2016-01-19), first\n> released with Git v2.8.0. We've been promising that it's a synonym of\n> --head, but it's not.\n> \n> We could make this work again by supplying the\n> PARSE_OPT_NO_INTERNAL_HELP flag to parse_options(), but if we were\n> writing this command today we wouldn't make this an exception. Since\n> it's been such a long time let's just remove this rather than\n> restoring the exception to \"-h\" handling.\n\nThis breaks the case when '-h' is used in combination with a remote:\n\n  $ git ls-remote -h origin\n  225bc32a989d7a22fa6addafd4ce7dcd04675dbf\trefs/heads/maint\n  ddb1055343948e0d0bc81f8d20245f1ada6430a0\trefs/heads/master\n  4c38ced6901a8523cea197b31b2616240ec9fb6e\trefs/heads/next\n  ee03ddbf0ea6a78ad9a229bd029408bbff85232e\trefs/heads/seen\n  687d33056ee28fd03567f3725150e3fcd0582979\trefs/heads/todo\n\n> Reported-by: Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  Documentation/git-ls-remote.txt | 1 -\n>  builtin/ls-remote.c             | 2 +-\n>  2 files changed, 1 insertion(+), 2 deletions(-)\n> \n> diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt\n> index 492e573856f..6e241640bd9 100644\n> --- a/Documentation/git-ls-remote.txt\n> +++ b/Documentation/git-ls-remote.txt\n> @@ -21,7 +21,6 @@ commit IDs.\n>  \n>  OPTIONS\n>  -------\n> --h::\n\nThe description of this option contains the following:\n\n  Note that git ls-remote -h used without anything else on the command\n  line gives help, consistent with other git subcommands.\n\n>  --heads::\n>  -t::\n>  --tags::\n> diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c\n> index f4fd823af83..c5e68918b78 100644\n> --- a/builtin/ls-remote.c\n> +++ b/builtin/ls-remote.c\n> @@ -64,7 +64,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)\n>  \t\t\t   N_(\"path of git-upload-pack on the remote host\"),\n>  \t\t\t   PARSE_OPT_HIDDEN },\n>  \t\tOPT_BIT('t', \"tags\", &flags, N_(\"limit to tags\"), REF_TAGS),\n> -\t\tOPT_BIT('h', \"heads\", &flags, N_(\"limit to heads\"), REF_HEADS),\n> +\t\tOPT_BIT(0, \"heads\", &flags, N_(\"limit to heads\"), REF_HEADS),\n>  \t\tOPT_BIT(0, \"refs\", &flags, N_(\"do not show peeled tags\"), REF_NORMAL),\n>  \t\tOPT_BOOL(0, \"get-url\", &get_url,\n>  \t\t\t N_(\"take url.<base>.insteadOf into account\")),\n> -- \n> 2.33.0.1285.g7aff81f6560\n> \n"},{"id":"436987","messageId":"YU4QxcORBBR01iV8@coredump.intra.peff.net","threadId":"56580","inReplyTo":"20210924171113.GA3311029@szeder.dev","subject":"Re: [PATCH 2/3] ls-remote: remove documentation for custom -h option","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-09-24T17:54:13Z","receivedAt":"2021-09-24T17:54:18Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Sep 24, 2021 at 07:11:13PM +0200, SZEDER Gábor wrote:\n\n> > diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt\n> > index 492e573856f..6e241640bd9 100644\n> > --- a/Documentation/git-ls-remote.txt\n> > +++ b/Documentation/git-ls-remote.txt\n> > @@ -21,7 +21,6 @@ commit IDs.\n> >  \n> >  OPTIONS\n> >  -------\n> > --h::\n> \n> The description of this option contains the following:\n> \n>   Note that git ls-remote -h used without anything else on the command\n>   line gives help, consistent with other git subcommands.\n\nYup. That comes from this thread discussing an identical patch:\n\n  https://lore.kernel.org/git/b0397b3285eab3448a3fd5dd2c50abb9@pascalroeleven.nl/\n\nwhich in turn references more discussion of this behavior:\n\n  https://lore.kernel.org/git/xmqqk1ztmkbn.fsf@gitster.mtv.corp.google.com/\n\nIt's gross and weird, but kept for backwards compatibility.\n\n-Peff\n"},{"id":"436993","messageId":"xmqqilypvo47.fsf@gitster.g","threadId":"56580","inReplyTo":"20210924141920.ezfpyf4uutob2h5z@zenon.in.qult.net","subject":"Re: Wrong option -h in grep, ls-remote, and show-ref.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-09-24T18:12:56Z","receivedAt":"2021-09-24T18:13:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr> writes:\n\n> What did you do before the bug happened? (Steps to reproduce your issue)\n>\n> git ls-remote -h\n>\n> What did you expect to happen? (Expected behavior)\n>\n> The same as git ls-remote --heads.\n>\n> What happened instead? (Actual behavior)\n>\n> Displayed the git ls-remote usage.\n\nThanks for a report, but this is very much working as intended.\n\nThere may be some subcommands that assign their own meaning to \"-h\"\nfor historical reasons (like \"ls-remote -h origin\"), or for external\nreasons (like \"grep -h -e pattern\"), but most newbies expect a short\nhelp out of \"-h\" uniformly across subcommands.\n\nFortunately, \"-h\" alone would not make any sense for \"grep\" (you\nneed a pattern) and you do not need to use \"-h\" for \"ls-remote\" [*].\nWe prioritized to help newbies by consistently giving a short help\nacross subcommands, over letting \"git grep -h\" to complain \"you need\nto give me a pattern\", like so:\n\n    $ git ls-remote --heads\n    fatal: No remote configured to list refs from.\n\n    $ git grep\n    fatal: no pattern given\n\n    $ git grep -h\n    usage: git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]\n\n    --cached              search in index instead of in the work tree\n    ...\n\n    $ git ls-remote -h\n    usage: git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n                         [-q | --quiet] [--exit-code] [--get-url]\n    ...\n\nHTH.\n\n\n[Footnote]\n\n* It is not end-user facing Porcelain, but is meant for scripting,\n  and you can afford to write \"--heads\".  Besides, \"-h\" acts as\n  \"--heads\" in \"git ls-remote -h origin\" or \"git ls-remote -h -q\"\n  just fine.  Only the \"-h and nothing else is given\" case is\n  sacrificed to help newbies in the case of this subcommand.\n\n\n\n"},{"id":"436995","messageId":"xmqqbl4hvnxa.fsf@gitster.g","threadId":"56580","inReplyTo":"20210924171113.GA3311029@szeder.dev","subject":"Re: [PATCH 2/3] ls-remote: remove documentation for custom -h option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-09-24T18:17:05Z","receivedAt":"2021-09-24T18:17:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder.dev@gmail.com> writes:\n\n> On Fri, Sep 24, 2021 at 06:51:45PM +0200, Ævar Arnfjörð Bjarmason wrote:\n>> The custom handling of the \"-h\" option was broken in\n>> ba5f28bf79e (ls-remote: use parse-options api, 2016-01-19), first\n>> released with Git v2.8.0. We've been promising that it's a synonym of\n>> --head, but it's not.\n>> \n>> We could make this work again by supplying the\n>> PARSE_OPT_NO_INTERNAL_HELP flag to parse_options(), but if we were\n>> writing this command today we wouldn't make this an exception. Since\n>> it's been such a long time let's just remove this rather than\n>> restoring the exception to \"-h\" handling.\n>\n> This breaks the case when '-h' is used in combination with a remote:\n\nYes, I think I covered this in my response to Ignacy.  Perhaps Ævar\ncan read it before rerolling this series.\n\nThanks.\n"},{"id":"437020","messageId":"xmqq8rzlu697.fsf@gitster.g","threadId":"56580","inReplyTo":"patch-1.3-c79a3907a27-20210924T164820Z-avarab@gmail.com","subject":"Re: [PATCH 1/3] show-ref: remove unused custom handling of -h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-09-24T19:24:04Z","receivedAt":"2021-09-24T19:24:09Z","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> Since b92891f9783 (parseopt: add PARSE_OPT_NO_INTERNAL_HELP,\n> 2009-03-08) parse_options() has handled \"-h\" unless told not to, so\n> when show-ref was migrated to parse_options() in\n> 69932bc6117 (show-ref: migrate to parse-options, 2009-06-20) the\n> custom \"-h\" handling that was retained did nothing.\n>\n> The option was then hidden in e62b3935056 (Show usage string for 'git\n> show-ref -h', 2009-11-09), but that OPT_BOOLEAN didn't do\n> anything. Let's just remove this dead code.\n>\n> Reported-by: Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  builtin/show-ref.c | 2 --\n>  1 file changed, 2 deletions(-)\n\nWhile this is a fine no-op, I am not sure this \"fixes\" complaint\nin Ignacy's report.  \"git show-ref -h\" would (and should) show the\nshort-help, no?\n\n"},{"id":"437044","messageId":"b0b1c64d-9b53-a64f-73db-b8552c7b66a2@web.de","threadId":"56580","inReplyTo":"xmqq8rzlu697.fsf@gitster.g","subject":"Re: [PATCH 1/3] show-ref: remove unused custom handling of -h","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2021-09-24T20:53:56Z","receivedAt":"2021-09-24T20:54:03Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 24.09.21 um 21:24 schrieb Junio C Hamano:\n> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>\n>> Since b92891f9783 (parseopt: add PARSE_OPT_NO_INTERNAL_HELP,\n>> 2009-03-08) parse_options() has handled \"-h\" unless told not to, so\n>> when show-ref was migrated to parse_options() in\n>> 69932bc6117 (show-ref: migrate to parse-options, 2009-06-20) the\n>> custom \"-h\" handling that was retained did nothing.\n>>\n>> The option was then hidden in e62b3935056 (Show usage string for 'git\n>> show-ref -h', 2009-11-09), but that OPT_BOOLEAN didn't do\n>> anything. Let's just remove this dead code.\n>>\n>> Reported-by: Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr>\n>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>> ---\n>>  builtin/show-ref.c | 2 --\n>>  1 file changed, 2 deletions(-)\n>\n> While this is a fine no-op, I am not sure this \"fixes\" complaint\n> in Ignacy's report.  \"git show-ref -h\" would (and should) show the\n> short-help, no?\n>\n\nIt would, but -h is not a no-op without this patch.  The option is\nequivalent to --heads as long as it's not the only argument.  E.g. it\nhas an effect in \"git show-ref -h HEA.\" or \"git show-ref -hh\".\n\nRené\n"},{"id":"437046","messageId":"xmqqfsttsm8x.fsf@gitster.g","threadId":"56580","inReplyTo":"b0b1c64d-9b53-a64f-73db-b8552c7b66a2@web.de","subject":"Re: [PATCH 1/3] show-ref: remove unused custom handling of -h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-09-24T21:21:34Z","receivedAt":"2021-09-24T21:21:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"René Scharfe <l.s.r@web.de> writes:\n\n> Am 24.09.21 um 21:24 schrieb Junio C Hamano:\n>> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>>\n>>> Since b92891f9783 (parseopt: add PARSE_OPT_NO_INTERNAL_HELP,\n>>> 2009-03-08) parse_options() has handled \"-h\" unless told not to, so\n>>> when show-ref was migrated to parse_options() in\n>>> 69932bc6117 (show-ref: migrate to parse-options, 2009-06-20) the\n>>> custom \"-h\" handling that was retained did nothing.\n>>>\n>>> The option was then hidden in e62b3935056 (Show usage string for 'git\n>>> show-ref -h', 2009-11-09), but that OPT_BOOLEAN didn't do\n>>> anything. Let's just remove this dead code.\n>>>\n>>> Reported-by: Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr>\n>>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>>> ---\n>>>  builtin/show-ref.c | 2 --\n>>>  1 file changed, 2 deletions(-)\n>>\n>> While this is a fine no-op, I am not sure this \"fixes\" complaint\n>> in Ignacy's report.  \"git show-ref -h\" would (and should) show the\n>> short-help, no?\n>>\n>\n> It would, but -h is not a no-op without this patch.  The option is\n> equivalent to --heads as long as it's not the only argument.  E.g. it\n> has an effect in \"git show-ref -h HEA.\" or \"git show-ref -hh\".\n\nAh, so this actively breaks the command?  Yeah, thanks---I smelled\nsomething fishy in the change.\n\n"}]}