git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Pascal Roeleven <dev@pascalroeleven.nl>
To: Danh Doan <congdanhqx@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/1] ls-remote: don't use '-h' for options
Date: Thu, 27 Feb 2020 15:10:17 +0100	[thread overview]
Message-ID: <03985e4099e82f04709d5ea9ca2a56a6@pascalroeleven.nl> (raw)
In-Reply-To: <20200227130833.GA10339@danh.dev>

On 2020-02-27 14:08, Danh Doan wrote:
> 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.

  reply	other threads:[~2020-02-27 14:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 11:42 [PATCH 1/1] ls-remote: don't use '-h' for options dev
2020-02-27 13:08 ` Danh Doan
2020-02-27 14:10   ` Pascal Roeleven [this message]
2020-02-27 16:10     ` Junio C Hamano
2020-02-27 17:39       ` Pascal Roeleven
2020-02-27 17:54         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03985e4099e82f04709d5ea9ca2a56a6@pascalroeleven.nl \
    --to=dev@pascalroeleven.nl \
    --cc=congdanhqx@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).