{"thread":{"id":"44172","subject":"question about git rev-list --max-count=n","startedAt":"2016-09-27T10:40:29Z","lastAt":"2016-09-28T01:52:54Z","messageCount":9,"participants":["Ruediger Meier","Pranit Bauva","Junio C Hamano","Philip Oakley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"302693","messageId":"201609271240.19759.sweet_f_a@gmx.de","threadId":"44172","inReplyTo":null,"subject":"question about git rev-list --max-count=n","fromName":"Ruediger Meier","fromEmail":"sweet_f_a@gmx.de","sentAt":"2016-09-27T10:40:19Z","receivedAt":"2016-09-27T10:40:29Z","isPatch":false,"sender":{"key":"sweet_f_a@gmx.de","avatar":"https://gravatar.com/avatar/843ae6d0a3ff0889760b87e753113a42ce58ef8001934294ad375a1d2e9f451e?d=mp&s=160"},"body":"Hi,\n\ngit rev-list --max-count=n\n\nseems to always list the _last_ (newest) n commits. Is there any \nfunctionality to list the _first_ n commits?\n\nI've tried to add --reverse hoping that this would do it but it does \nnot.\n\nThe manual could be a bit more clear about that:\n    --max-count=<number>   Limit the number of commits to output.\n\n\nIf it really would only limit the _output_ (like head -n), then \nIMO --reverse should do what I want.\n\n\nRegarding my initial question. Maybe we could support\n   --max-count=-n\nto list the first n commits.\n\ncu,\nRudi\n  \n"},{"id":"302701","messageId":"010201576bfb6c7d-0b68228f-9503-4dd1-9721-713477fa2596-000000@eu-west-1.amazonses.com","threadId":"44172","inReplyTo":"201609271240.19759.sweet_f_a@gmx.de","subject":"[PATCH] rev-list-options: clarify the usage of -n/--max-number","fromName":"Pranit Bauva","fromEmail":"pranit.bauva@gmail.com","sentAt":"2016-09-27T14:10:22Z","receivedAt":"2016-09-27T14:10:28Z","isPatch":true,"sender":{"key":"pranit.bauva@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2959938?v=4"},"body":"-n=<number>, -<number>, --max-number=<number> shows the last n commits\nspecified in <number> irrespective of whether --reverse is used or not.\nWith --reverse, it just shows the last n commits in reverse order.\n\nReported-by: Ruediger Meier <sweet_f_a@gmx.de>\nSigned-off-by: Pranit Bauva <pranit.bauva@gmail.com>\n\n---\nHey Ruegiger,\n\nThe description is a bit inappropriate for --max-count and thus this\npatch.\n\nI cannot comment whether --max-count=-n would be a good choice or not\nbecause personally I never left the need of it. I normally use --reverse\nso as to review my patches in a branch serially. So for me the current\nusage of --reverse seems more appropriate.\n---\n Documentation/rev-list-options.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\nindex 7e462d3..6b7c2e5 100644\n--- a/Documentation/rev-list-options.txt\n+++ b/Documentation/rev-list-options.txt\n@@ -18,7 +18,7 @@ ordering and formatting options, such as `--reverse`.\n -<number>::\n -n <number>::\n --max-count=<number>::\n-\tLimit the number of commits to output.\n+\tLimit to last n number of commits to output specified in <number>.\n \n --skip=<number>::\n \tSkip 'number' commits before starting to show the commit output.\n\n--\nhttps://github.com/git/git/pull/296\n"},{"id":"302718","messageId":"xmqq1t05qoad.fsf@gitster.mtv.corp.google.com","threadId":"44172","inReplyTo":"010201576bfb6c7d-0b68228f-9503-4dd1-9721-713477fa2596-000000@eu-west-1.amazonses.com","subject":"Re: [PATCH] rev-list-options: clarify the usage of -n/--max-number","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-27T16:51:22Z","receivedAt":"2016-09-27T16:52:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pranit Bauva <pranit.bauva@gmail.com> writes:\n\n> -n=<number>, -<number>, --max-number=<number> shows the last n commits\n> specified in <number> irrespective of whether --reverse is used or not.\n> With --reverse, it just shows the last n commits in reverse order.\n\nI think it is easier to understand if you updated the description of\n\"--reverse\", rather than \"-<n>\".  \"rev-list -n $N\" that stops after\nshowing $N commits is something everybody understands.  What often\ndissapoints some users is that \"--reverse\" kicks in _after_ what\ncommits are to be shown are decided.\n\n>  Documentation/rev-list-options.txt | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\n> index 7e462d3..6b7c2e5 100644\n> --- a/Documentation/rev-list-options.txt\n> +++ b/Documentation/rev-list-options.txt\n> @@ -18,7 +18,7 @@ ordering and formatting options, such as `--reverse`.\n>  -<number>::\n>  -n <number>::\n>  --max-count=<number>::\n> -\tLimit the number of commits to output.\n> +\tLimit to last n number of commits to output specified in <number>.\n\nThese essentially say the same thing.  The original does not mention\nwhere and how <number> is used, but \"Limit the number of commits\" as\na description for \"-<number>\" would be understood by anybody halfway\nintelligent that the given number is used as that limit, so I do not\nthink an updated description is making it easier to understand.\n\nThere is a paragraph of interest in an earlier part of \"Commit\nLimiting\" section (which is the section \"-n\" appears in, among other\noptions):\n\n    Note that these are applied before commit\n    ordering and formatting options, such as `--reverse`.\n\nSo the documentation already makes an attempt to avoid confusion\nRuediger saw, i.e. \"rev-list traverses, limits the output to N, and\nthen shows these N commits in reverse\" is what it expects readers to\nunderstand, and that it also expects it would lead naturally to\n\"these N commits are still from the newest part of the history,\nhence 'rev-list --reverse -n N' is not how you grab the earliest N\".\n\nBut apparently the attempt by the current documentation is not\nenough.  Let's see how it describes the '--reverse' option:\n\n    Commit Ordering\n    ~~~~~~~~~~~~~~~\n\n    By default, the commits are shown in reverse chronological order.\n    ...\n\n    --reverse::\n            Output the commits in reverse order.\n            Cannot be combined with `--walk-reflogs`.\n\nPerhaps \"Output the commits chosen to be shown (see Commit Limiting\nsection above) in reverse order.\" would make it clearer?\n"},{"id":"302755","messageId":"CAFZEwPPev-fxev0jHsdj3MbtpX=SMFJ3gTjeJ2Uz8vcuknAL3w@mail.gmail.com","threadId":"44172","inReplyTo":"xmqq1t05qoad.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] rev-list-options: clarify the usage of -n/--max-number","fromName":"Pranit Bauva","fromEmail":"pranit.bauva@gmail.com","sentAt":"2016-09-27T20:32:54Z","receivedAt":"2016-09-27T20:33:18Z","isPatch":true,"sender":{"key":"pranit.bauva@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2959938?v=4"},"body":"Hey Junio,\n\nOn Tue, Sep 27, 2016 at 10:21 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Pranit Bauva <pranit.bauva@gmail.com> writes:\n>\n>> -n=<number>, -<number>, --max-number=<number> shows the last n commits\n>> specified in <number> irrespective of whether --reverse is used or not.\n>> With --reverse, it just shows the last n commits in reverse order.\n>\n> I think it is easier to understand if you updated the description of\n> \"--reverse\", rather than \"-<n>\".  \"rev-list -n $N\" that stops after\n> showing $N commits is something everybody understands.  What often\n> dissapoints some users is that \"--reverse\" kicks in _after_ what\n> commits are to be shown are decided.\n\nTrue.\n\n>>  Documentation/rev-list-options.txt | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\n>> index 7e462d3..6b7c2e5 100644\n>> --- a/Documentation/rev-list-options.txt\n>> +++ b/Documentation/rev-list-options.txt\n>> @@ -18,7 +18,7 @@ ordering and formatting options, such as `--reverse`.\n>>  -<number>::\n>>  -n <number>::\n>>  --max-count=<number>::\n>> -     Limit the number of commits to output.\n>> +     Limit to last n number of commits to output specified in <number>.\n>\n> These essentially say the same thing.  The original does not mention\n> where and how <number> is used, but \"Limit the number of commits\" as\n> a description for \"-<number>\" would be understood by anybody halfway\n> intelligent that the given number is used as that limit, so I do not\n> think an updated description is making it easier to understand.\n\nTo clear out that confused I used the word \"last\" but I can now\nunderstand that it can be easily misunderstood.\n\n> There is a paragraph of interest in an earlier part of \"Commit\n> Limiting\" section (which is the section \"-n\" appears in, among other\n> options):\n>\n>     Note that these are applied before commit\n>     ordering and formatting options, such as `--reverse`.\n>\n> So the documentation already makes an attempt to avoid confusion\n> Ruediger saw, i.e. \"rev-list traverses, limits the output to N, and\n> then shows these N commits in reverse\" is what it expects readers to\n> understand, and that it also expects it would lead naturally to\n> \"these N commits are still from the newest part of the history,\n> hence 'rev-list --reverse -n N' is not how you grab the earliest N\".\n\nIt surely does :)\n\n> But apparently the attempt by the current documentation is not\n> enough.  Let's see how it describes the '--reverse' option:\n>\n>     Commit Ordering\n>     ~~~~~~~~~~~~~~~\n>\n>     By default, the commits are shown in reverse chronological order.\n>     ...\n>\n>     --reverse::\n>             Output the commits in reverse order.\n>             Cannot be combined with `--walk-reflogs`.\n>\n> Perhaps \"Output the commits chosen to be shown (see Commit Limiting\n> section above) in reverse order.\" would make it clearer?\n\nThat would be a much better edit. Thanks! Will send out a re-roll.\n\nRegards,\nPranit Bauva\n"},{"id":"302760","messageId":"010201576d63f422-abe45938-0da1-4fc0-b0e7-3e552b59d10a-000000@eu-west-1.amazonses.com","threadId":"44172","inReplyTo":"010201576bfb6c7d-0b68228f-9503-4dd1-9721-713477fa2596-000000@eu-west-1.amazonses.com","subject":"[PATCH v2] rev-list-options: clarify the usage of --reverse","fromName":"Pranit Bauva","fromEmail":"pranit.bauva@gmail.com","sentAt":"2016-09-27T20:44:09Z","receivedAt":"2016-09-27T20:44:16Z","isPatch":true,"sender":{"key":"pranit.bauva@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2959938?v=4"},"body":"Specify even more clearly that --reverse works only with the commits\nwhich are chosen to be shown so as to eliminate the confusion as to\nwhether the first n or the last n commits with be shown when used\nwith `-n --reverse`.\n\nReported-by: Ruediger Meier <sweet_f_a@gmx.de>\nSigned-off-by: Pranit Bauva <pranit.bauva@gmail.com>\n---\n Documentation/rev-list-options.txt | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\nindex 7e462d3..5da7cf5 100644\n--- a/Documentation/rev-list-options.txt\n+++ b/Documentation/rev-list-options.txt\n@@ -657,8 +657,9 @@ avoid showing the commits from two parallel development track mixed\n together.\n \n --reverse::\n-\tOutput the commits in reverse order.\n-\tCannot be combined with `--walk-reflogs`.\n+\tOutput the commits chosen to be shown (see Commit Limiting\n+\tsection above) in reverse order. Cannot be combined with\n+\t`--walk-reflogs`.\n \n Object Traversal\n ~~~~~~~~~~~~~~~~\n\n--\nhttps://github.com/git/git/pull/296\n"},{"id":"302774","messageId":"A9427F4400044104B47378E024C7C2A4@PhilipOakley","threadId":"44172","inReplyTo":"010201576d63f422-abe45938-0da1-4fc0-b0e7-3e552b59d10a-000000@eu-west-1.amazonses.com","subject":"Re: [PATCH v2] rev-list-options: clarify the usage of --reverse","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2016-09-27T21:51:30Z","receivedAt":"2016-09-27T21:51:36Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Pranit Bauva\" <pranit.bauva@gmail.com>\n> Specify even more clearly that --reverse works only with the commits\n> which are chosen to be shown so as to eliminate the confusion as to\n> whether the first n or the last n commits with be shown when used\n\nhi Pranit,\nmicro-nit: 'first' and 'last' can be tricky to distinguish for lists (e.g. \nof commits) that can be considered from both ends with equal ease (people \nare so easily confused ;-). In such cases its always worth stating the sort \norder mechanism (within the appropriate sentence). However, in this case the \nclarification is to clearly point elsewhere, so I'm OK with the patch.\n\n> with `-n --reverse`.\n>\n> Reported-by: Ruediger Meier <sweet_f_a@gmx.de>\n> Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>\n> ---\n> Documentation/rev-list-options.txt | 5 +++--\n> 1 file changed, 3 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/rev-list-options.txt \n> b/Documentation/rev-list-options.txt\n> index 7e462d3..5da7cf5 100644\n> --- a/Documentation/rev-list-options.txt\n> +++ b/Documentation/rev-list-options.txt\n> @@ -657,8 +657,9 @@ avoid showing the commits from two parallel \n> development track mixed\n> together.\n>\n> --reverse::\n> - Output the commits in reverse order.\n> - Cannot be combined with `--walk-reflogs`.\n> + Output the commits chosen to be shown (see Commit Limiting\n> + section above) in reverse order. Cannot be combined with\n> + `--walk-reflogs`.\n>\n> Object Traversal\n> ~~~~~~~~~~~~~~~~\n>\n> --\n> https://github.com/git/git/pull/296\n>\n--\nPhilip \n\n"},{"id":"302779","messageId":"xmqqoa39kn57.fsf@gitster.mtv.corp.google.com","threadId":"44172","inReplyTo":"A9427F4400044104B47378E024C7C2A4@PhilipOakley","subject":"Re: [PATCH v2] rev-list-options: clarify the usage of --reverse","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-27T22:12:36Z","receivedAt":"2016-09-27T22:12:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Philip Oakley\" <philipoakley@iee.org> writes:\n\n> micro-nit: 'first' and 'last' can be tricky to distinguish for lists...\n\nLet's do this then.\n\n-- >8 --\nFrom: Pranit Bauva <pranit.bauva@gmail.com>\nDate: Tue, 27 Sep 2016 20:44:09 +0000\nSubject: [PATCH] rev-list-options: clarify the usage of --reverse\n\nUsers often wonder if the oldest or the newest n commits are shown\nby `log -n --reverse`.  Clarify that --reverse kicks in only after\ndeciding which commits are to be shown to unconfuse them.\n\nReported-by: Ruediger Meier <sweet_f_a@gmx.de>\nSigned-off-by: Pranit Bauva <pranit.bauva@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/rev-list-options.txt | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\nindex 4f009d4..f8946d4 100644\n--- a/Documentation/rev-list-options.txt\n+++ b/Documentation/rev-list-options.txt\n@@ -638,8 +638,9 @@ avoid showing the commits from two parallel development track mixed\n together.\n \n --reverse::\n-\tOutput the commits in reverse order.\n-\tCannot be combined with `--walk-reflogs`.\n+\tOutput the commits chosen to be shown (see Commit Limiting\n+\tsection above) in reverse order. Cannot be combined with\n+\t`--walk-reflogs`.\n \n Object Traversal\n ~~~~~~~~~~~~~~~~\n-- \n2.10.0-561-g98a6b79\n\n"},{"id":"302780","messageId":"5006033DE52444EAB624BEA7E5A16746@PhilipOakley","threadId":"44172","inReplyTo":"xmqqoa39kn57.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2] rev-list-options: clarify the usage of --reverse","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2016-09-27T22:21:21Z","receivedAt":"2016-09-27T22:22:07Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Junio C Hamano\" <gitster@pobox.com>\n> \"Philip Oakley\" <philipoakley@iee.org> writes:\n>\n>> micro-nit: 'first' and 'last' can be tricky to distinguish for lists...\n>\n> Let's do this then.\n\nLooks good to me. Thanks. -- Philip\n\n>\n> -- >8 --\n> From: Pranit Bauva <pranit.bauva@gmail.com>\n> Date: Tue, 27 Sep 2016 20:44:09 +0000\n> Subject: [PATCH] rev-list-options: clarify the usage of --reverse\n>\n> Users often wonder if the oldest or the newest n commits are shown\n> by `log -n --reverse`.  Clarify that --reverse kicks in only after\n> deciding which commits are to be shown to unconfuse them.\n>\n> Reported-by: Ruediger Meier <sweet_f_a@gmx.de>\n> Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n> Documentation/rev-list-options.txt | 5 +++--\n> 1 file changed, 3 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/rev-list-options.txt \n> b/Documentation/rev-list-options.txt\n> index 4f009d4..f8946d4 100644\n> --- a/Documentation/rev-list-options.txt\n> +++ b/Documentation/rev-list-options.txt\n> @@ -638,8 +638,9 @@ avoid showing the commits from two parallel \n> development track mixed\n> together.\n>\n> --reverse::\n> - Output the commits in reverse order.\n> - Cannot be combined with `--walk-reflogs`.\n> + Output the commits chosen to be shown (see Commit Limiting\n> + section above) in reverse order. Cannot be combined with\n> + `--walk-reflogs`.\n>\n> Object Traversal\n> ~~~~~~~~~~~~~~~~\n> -- \n> 2.10.0-561-g98a6b79\n>\n> \n\n"},{"id":"302786","messageId":"CAFZEwPMe=eLbazZcj8Ce5m01VCt+V2sSix5B_spYRzz7cqsOOw@mail.gmail.com","threadId":"44172","inReplyTo":"xmqqoa39kn57.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2] rev-list-options: clarify the usage of --reverse","fromName":"Pranit Bauva","fromEmail":"pranit.bauva@gmail.com","sentAt":"2016-09-28T01:52:47Z","receivedAt":"2016-09-28T01:52:54Z","isPatch":true,"sender":{"key":"pranit.bauva@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2959938?v=4"},"body":"Hey Junio,\n\nOn Wed, Sep 28, 2016 at 3:42 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> \"Philip Oakley\" <philipoakley@iee.org> writes:\n>\n>> micro-nit: 'first' and 'last' can be tricky to distinguish for lists...\n>\n> Let's do this then.\n>\n> -- >8 --\n> From: Pranit Bauva <pranit.bauva@gmail.com>\n> Date: Tue, 27 Sep 2016 20:44:09 +0000\n> Subject: [PATCH] rev-list-options: clarify the usage of --reverse\n>\n> Users often wonder if the oldest or the newest n commits are shown\n> by `log -n --reverse`.  Clarify that --reverse kicks in only after\n> deciding which commits are to be shown to unconfuse them.\n>\n> Reported-by: Ruediger Meier <sweet_f_a@gmx.de>\n> Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n\nLooks good! Thanks!\n\n>  Documentation/rev-list-options.txt | 5 +++--\n>  1 file changed, 3 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\n> index 4f009d4..f8946d4 100644\n> --- a/Documentation/rev-list-options.txt\n> +++ b/Documentation/rev-list-options.txt\n> @@ -638,8 +638,9 @@ avoid showing the commits from two parallel development track mixed\n>  together.\n>\n>  --reverse::\n> -       Output the commits in reverse order.\n> -       Cannot be combined with `--walk-reflogs`.\n> +       Output the commits chosen to be shown (see Commit Limiting\n> +       section above) in reverse order. Cannot be combined with\n> +       `--walk-reflogs`.\n>\n>  Object Traversal\n>  ~~~~~~~~~~~~~~~~\n> --\n> 2.10.0-561-g98a6b79\n>\n"}]}