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

Re: [PATCH] rev-list-options: clarify the usage of -n/--max-number

From
Pranit Bauva <pranit.bauva@gmail.com>
Date
Sep 27, 2016, 20:32 UTC
Message-ID
<CAFZEwPPev-fxev0jHsdj3MbtpX=SMFJ3gTjeJ2Uz8vcuknAL3w@mail.gmail.com>
In-Reply-To
<xmqq1t05qoad.fsf@gitster.mtv.corp.google.com>
Hey Junio,
On Tue, Sep 27, 2016 at 10:21 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> Pranit Bauva <pranit.bauva@gmail.com> writes:
>
>> -n=<number>, -<number>, --max-number=<number> shows the last n commits
>> specified in <number> irrespective of whether --reverse is used or not.
>> With --reverse, it just shows the last n commits in reverse order.
>
> I think it is easier to understand if you updated the description of
> "--reverse", rather than "-<n>".  "rev-list -n $N" that stops after
> showing $N commits is something everybody understands.  What often
> dissapoints some users is that "--reverse" kicks in _after_ what
> commits are to be shown are decided.
True.
Show 19 quoted lines
>>  Documentation/rev-list-options.txt | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
>> index 7e462d3..6b7c2e5 100644
>> --- a/Documentation/rev-list-options.txt
>> +++ b/Documentation/rev-list-options.txt
>> @@ -18,7 +18,7 @@ ordering and formatting options, such as `--reverse`.
>>  -<number>::
>>  -n <number>::
>>  --max-count=<number>::
>> -     Limit the number of commits to output.
>> +     Limit to last n number of commits to output specified in <number>.
>
> These essentially say the same thing.  The original does not mention
> where and how <number> is used, but "Limit the number of commits" as
> a description for "-<number>" would be understood by anybody halfway
> intelligent that the given number is used as that limit, so I do not
> think an updated description is making it easier to understand.

To clear out that confused I used the word "last" but I can now understand that it can be easily misunderstood.

Show 13 quoted lines
> There is a paragraph of interest in an earlier part of "Commit
> Limiting" section (which is the section "-n" appears in, among other
> options):
>
>     Note that these are applied before commit
>     ordering and formatting options, such as `--reverse`.
>
> So the documentation already makes an attempt to avoid confusion
> Ruediger saw, i.e. "rev-list traverses, limits the output to N, and
> then shows these N commits in reverse" is what it expects readers to
> understand, and that it also expects it would lead naturally to
> "these N commits are still from the newest part of the history,
> hence 'rev-list --reverse -n N' is not how you grab the earliest N".
It surely does :)
Show 15 quoted lines
> But apparently the attempt by the current documentation is not
> enough.  Let's see how it describes the '--reverse' option:
>
>     Commit Ordering
>     ~~~~~~~~~~~~~~~
>
>     By default, the commits are shown in reverse chronological order.
>     ...
>
>     --reverse::
>             Output the commits in reverse order.
>             Cannot be combined with `--walk-reflogs`.
>
> Perhaps "Output the commits chosen to be shown (see Commit Limiting
> section above) in reverse order." would make it clearer?
That would be a much better edit. Thanks! Will send out a re-roll.

Regards, Pranit Bauva

Previous: Junio C HamanoNext: Pranit Bauva
Message 4 of 9 in “question about git rev-list --max-count=n”
  1. Ruediger MeierSep 27, 2016
  2. rev-list-options: clarify the usage of -n/--max-numberPranit Bauva, Sep 27, 2016
  3. Junio C HamanoSep 27, 2016
  4. Pranit BauvaSep 27, 2016
  5. rev-list-options: clarify the usage of --reversePranit Bauva, Sep 27, 2016
  6. Philip OakleySep 27, 2016
  7. Junio C HamanoSep 27, 2016
  8. Philip OakleySep 27, 2016
  9. Pranit BauvaSep 28, 2016

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.