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

Re: [PATCH] ls-remote: create '--count' option

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 18, 2019, 17:28 UTC
Message-ID
<xmqqo8zh5xab.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<f643547f-54e0-fe4f-d8e5-95445431faf3@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 57 quoted lines
> 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.

Previous: Johannes SixtNext: Kamil Domański
Message 3 of 5 in “ls-remote: create '--count' option”
  1. ls-remote: create '--count' optionKamil Domański, Sep 18, 2019
  2. Johannes SixtSep 18, 2019
  3. Junio C HamanoSep 18, 2019
  4. Kamil DomańskiSep 18, 2019
  5. Johannes SixtSep 19, 2019

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.