git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: "Kamil Domański" <kamil@domanski.co>, git@vger.kernel.org
Subject: Re: [PATCH] ls-remote: create '--count' option
Date: Wed, 18 Sep 2019 10:28:28 -0700	[thread overview]
Message-ID: <xmqqo8zh5xab.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <f643547f-54e0-fe4f-d8e5-95445431faf3@kdbg.org> (Johannes Sixt's message of "Wed, 18 Sep 2019 08:28:11 +0200")

Johannes Sixt <j6t@kdbg.org> writes:

> Am 18.09.19 um 02:11 schrieb Kamil Domański:
>> Create a '--count' option for ls-remote, based on the one from
>> for-each-ref. This allows e.g. to return only the first result
>> from a sorted list of refs.
>> 
>> Signed-off-by: Kamil Domański <kamil@domanski.co>
>> ---
>>  Documentation/git-ls-remote.txt | 11 ++++++++---
>>  builtin/ls-remote.c             | 16 ++++++++++++----
>>  t/t5512-ls-remote.sh            |  9 +++++++++
>>  3 files changed, 29 insertions(+), 7 deletions(-)
>> 
>> diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
>> index 0b057cbb10..5adc1d676e 100644
>> --- a/Documentation/git-ls-remote.txt
>> +++ b/Documentation/git-ls-remote.txt
>> @@ -9,9 +9,9 @@ git-ls-remote - List references in a remote repository
>>  SYNOPSIS
>>  --------
>>  [verse]
>> -'git ls-remote' [--heads] [--tags] [--refs] [--upload-pack=<exec>]
>> -	      [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]
>> -	      [--symref] [<repository> [<refs>...]]
>> +'git ls-remote' [--count=<count>] [--heads] [--tags] [--refs]
>> +	      [--upload-pack=<exec>] [-q | --quiet] [--exit-code] [--get-url]
>> +	      [--sort=<key>] [--symref] [<repository> [<refs>...]]
>
> It is understandable that the new option is important to _you_, but it
> does not seem important enough that it must be the first in the list.
> Please add it between --symref and <repository>
>
>>  
>>  DESCRIPTION
>>  -----------
>> @@ -21,6 +21,11 @@ commit IDs.
>>  
>>  OPTIONS
>>  -------
>> +--count=<count>::
>> +	By default the command shows all refs that match
>> +	`<pattern>`.  This option makes it stop after showing
>> +	that many refs.
>
> Is the meaning of this option perhaps:
>
>     Stops after the specified count of refs have been listed.
>     If `--sort=<key>` is specified as well, refs are counted
>     after sorting; otherwise, it is unspecified which subset
>     of is listed.
>
> I do not know whether the "otherwise" part would be true (check it!),
> but I am pretty certain that the "If" part must be true, otherwise the
> option would be pointless.
>
> The comment about the ordering of this paragraph at the very beginning
> of the option list applies here, too, because the list is not sorted
> alphabetically.

All sensible comments and suggestions.  I am not sure what's so hard
to pipe the output to "head -n 20" or something like that, though.

  reply	other threads:[~2019-09-18 17:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18  0:11 [PATCH] ls-remote: create '--count' option Kamil Domański
2019-09-18  6:28 ` Johannes Sixt
2019-09-18 17:28   ` Junio C Hamano [this message]
2019-09-18 21:44   ` Kamil Domański
2019-09-19 18:40     ` Johannes Sixt

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

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

  git send-email \
    --in-reply-to=xmqqo8zh5xab.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=kamil@domanski.co \
    /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.
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 NNTP newsgroup(s).