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

Re: [PATCH 1/1] ls-remote: don't use '-h' for options

From
PRPascal Roeleven <dev@pascalroeleven.nl>
Date
Feb 27, 2020, 14:10 UTC
Message-ID
<03985e4099e82f04709d5ea9ca2a56a6@pascalroeleven.nl>
In-Reply-To
<20200227130833.GA10339@danh.dev>
On 2020-02-27 14:08, Danh Doan wrote:
Show 16 quoted lines
> On 2020-02-27 12:42:18+0100, dev@pascalroeleven.nl wrote:
>> The '-h' option for ls-remote will never be reached as the argument is
>> already processed by the git wrapper before passed on to ls-remote.
>> The ls-remote help text will therefore be displayed instead of the
>> '--heads' option.
> 
> No, git ls-remote still see '-h'
> 
> - 'git ls-remote -h' will show short help.
> - 'git ls-remote -h <remote>' and 'git ls-remote --heads <remote>'
>   will show the same output
> 
> See also:
> https://lore.kernel.org/git/xmqqk1ztmkbn.fsf@gitster.mtv.corp.google.com/
> 
> xmqqk1ztmkbn.fsf@gitster.mtv.corp.google.com

You are right, I didn't test with <remote>. Thanks for pointing me to the old discussion.

Because '--heads' can be used without a remote, and '-h' is advertised as the shorthand equivalent, they should produce exactly the same output. And they don't. The discussion aside if you should use '-h' for anything at all except showing help, in my opinion if an option is listed as an alias for another option, they should produce the same result for all (or in this case the lack of) parameters.

In my case I looked into the documentation, used '-h' exactly as described ('<refs>' is optional) and it didn't produce the output as described. If you ask me, either the code or the documentation should be changed.

Previous: Danh DoanNext: Junio C Hamano
Message 3 of 6 in “ls-remote: don't use '-h' for options”
  1. 1/1 ls-remote: don't use '-h' for optionsdev@pascalroeleven.nl, Feb 27, 2020
  2. Danh DoanFeb 27, 2020
  3. Pascal RoelevenFeb 27, 2020
  4. Junio C HamanoFeb 27, 2020
  5. Pascal RoelevenFeb 27, 2020
  6. Junio C HamanoFeb 27, 2020

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.