git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/3] ls-remote: remove documentation for custom -h option

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Sep 24, 2021, 17:11 UTC
Message-ID
<20210924171113.GA3311029@szeder.dev>
In-Reply-To
<patch-2.3-32b8dbecfe0-20210924T164820Z-avarab@gmail.com>
On Fri, Sep 24, 2021 at 06:51:45PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 10 quoted lines
> The custom handling of the "-h" option was broken in
> ba5f28bf79e (ls-remote: use parse-options api, 2016-01-19), first
> released with Git v2.8.0. We've been promising that it's a synonym of
> --head, but it's not.
> 
> We could make this work again by supplying the
> PARSE_OPT_NO_INTERNAL_HELP flag to parse_options(), but if we were
> writing this command today we wouldn't make this an exception. Since
> it's been such a long time let's just remove this rather than
> restoring the exception to "-h" handling.
This breaks the case when '-h' is used in combination with a remote:
  $ git ls-remote -h origin
  225bc32a989d7a22fa6addafd4ce7dcd04675dbf	refs/heads/maint
  ddb1055343948e0d0bc81f8d20245f1ada6430a0	refs/heads/master
  4c38ced6901a8523cea197b31b2616240ec9fb6e	refs/heads/next
  ee03ddbf0ea6a78ad9a229bd029408bbff85232e	refs/heads/seen
  687d33056ee28fd03567f3725150e3fcd0582979	refs/heads/todo
Show 16 quoted lines
> Reported-by: Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  Documentation/git-ls-remote.txt | 1 -
>  builtin/ls-remote.c             | 2 +-
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
> index 492e573856f..6e241640bd9 100644
> --- a/Documentation/git-ls-remote.txt
> +++ b/Documentation/git-ls-remote.txt
> @@ -21,7 +21,6 @@ commit IDs.
>  
>  OPTIONS
>  -------
> --h::
The description of this option contains the following:
  Note that git ls-remote -h used without anything else on the command
  line gives help, consistent with other git subcommands.
Show 19 quoted lines
>  --heads::
>  -t::
>  --tags::
> diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
> index f4fd823af83..c5e68918b78 100644
> --- a/builtin/ls-remote.c
> +++ b/builtin/ls-remote.c
> @@ -64,7 +64,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
>  			   N_("path of git-upload-pack on the remote host"),
>  			   PARSE_OPT_HIDDEN },
>  		OPT_BIT('t', "tags", &flags, N_("limit to tags"), REF_TAGS),
> -		OPT_BIT('h', "heads", &flags, N_("limit to heads"), REF_HEADS),
> +		OPT_BIT(0, "heads", &flags, N_("limit to heads"), REF_HEADS),
>  		OPT_BIT(0, "refs", &flags, N_("do not show peeled tags"), REF_NORMAL),
>  		OPT_BOOL(0, "get-url", &get_url,
>  			 N_("take url.<base>.insteadOf into account")),
> -- 
> 2.33.0.1285.g7aff81f6560
> 
Previous: Ævar Arnfjörð BjarmasonNext: Jeff King
Message 8 of 12 in “Wrong option -h in grep, ls-remote, and show-ref.”
  1. Ignacy GawedzkiSep 24, 2021
  2. 0/3 show-ref, ls-remote, grep: fix -h handlingÆvar Arnfjörð Bjarmason, Sep 24, 2021
  3. 1/3 show-ref: remove unused custom handling of -hÆvar Arnfjörð Bjarmason, Sep 24, 2021
  4. Junio C HamanoSep 24, 2021
  5. René ScharfeSep 24, 2021
  6. Junio C HamanoSep 24, 2021
  7. 2/3 ls-remote: remove documentation for custom -h optionÆvar Arnfjörð Bjarmason, Sep 24, 2021
  8. SZEDER GáborSep 24, 2021
  9. Jeff KingSep 24, 2021
  10. Junio C HamanoSep 24, 2021
  11. 3/3 grep: pass PARSE_OPT_NO_INTERNAL_HELP, fix odd -h handlingÆvar Arnfjörð Bjarmason, Sep 24, 2021
  12. Junio C HamanoSep 24, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.