threads / patch / 52164

patchgit-shortlog.txt: mention commit filtering options

Subject: [PATCH] git-shortlog.txt: mention commit filtering options

## tl;dr

7 messages between Oct 30, 2019 and Nov 8, 2019. Diffs are folded; open one to read it.

replies: 6people: 2as markdown or json

Pratyush Yadav· Oct 30, 2019, 20:36 UTC · lore

git-shortlog, like git-log, supports options to filter what commits are used to generate the log. These options come from git-rev-list. Add a pointer to these options in the documentation page so readers can know these filtering options can be used with git-shortlog too.

Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
---
Since [0] didn't get any responses, I figured a patch might get some
more attention since it is something concrete to comment on.
[0] https://public-inbox.org/git/20191024191709.gqkjljuibyashtma@yadavpratyush.com/
 Documentation/git-shortlog.txt | 5 +++++
 1 file changed, 5 insertions(+)
Show changes to Documentation/git-shortlog.txt +5 −1
diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
index bc80905a8a..acae695388 100644
--- a/Documentation/git-shortlog.txt
+++ b/Documentation/git-shortlog.txt
@@ -76,6 +76,11 @@ them.
 Paths may need to be prefixed with `--` to separate them from
 options or the revision range, when confusion arises.

+In addition to the options above, 'git shortlog' also supports a range of
+options to select which subset of commits will be used to generate the
+shortlog. A list of these options can be found in the "Commit Limiting"
+section of linkgit:git-rev-list[1].
+
 MAPPING AUTHORS
 ---------------

--
2.21.0
Junio C Hamano· Nov 2, 2019, 05:43 UTC · re: Pratyush Yadav · lore

Re: [PATCH] git-shortlog.txt: mention commit filtering options

Pratyush Yadav <me@yadavpratyush.com> writes:
Show 27 quoted lines
> git-shortlog, like git-log, supports options to filter what commits are
> used to generate the log. These options come from git-rev-list. Add a
> pointer to these options in the documentation page so readers can know
> these filtering options can be used with git-shortlog too.
>
> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
> ---
> Since [0] didn't get any responses, I figured a patch might get some
> more attention since it is something concrete to comment on.
>
> [0] https://public-inbox.org/git/20191024191709.gqkjljuibyashtma@yadavpratyush.com/
>
>  Documentation/git-shortlog.txt | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
> index bc80905a8a..acae695388 100644
> --- a/Documentation/git-shortlog.txt
> +++ b/Documentation/git-shortlog.txt
> @@ -76,6 +76,11 @@ them.
>  Paths may need to be prefixed with `--` to separate them from
>  options or the revision range, when confusion arises.
>
> +In addition to the options above, 'git shortlog' also supports a range of
> +options to select which subset of commits will be used to generate the
> +shortlog. A list of these options can be found in the "Commit Limiting"
> +section of linkgit:git-rev-list[1].

How does "git log --help" handle the corresponding part of its documentation?

	... goes and looks ...

I wonder if it is better to just include rev-list-options.txt like "git-log.txt" does, instead of adding these four lines?

Thanks.
Show 5 quoted lines
>  MAPPING AUTHORS
>  ---------------
>
> --
> 2.21.0
Pratyush Yadav· Nov 2, 2019, 22:50 UTC · re: Junio C Hamano · lore

Re: [PATCH] git-shortlog.txt: mention commit filtering options

On 02/11/19 02:43PM, Junio C Hamano wrote:
Show 37 quoted lines
> Pratyush Yadav <me@yadavpratyush.com> writes:
> 
> > git-shortlog, like git-log, supports options to filter what commits are
> > used to generate the log. These options come from git-rev-list. Add a
> > pointer to these options in the documentation page so readers can know
> > these filtering options can be used with git-shortlog too.
> >
> > Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
> > ---
> > Since [0] didn't get any responses, I figured a patch might get some
> > more attention since it is something concrete to comment on.
> >
> > [0] https://public-inbox.org/git/20191024191709.gqkjljuibyashtma@yadavpratyush.com/
> >
> >  Documentation/git-shortlog.txt | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
> > index bc80905a8a..acae695388 100644
> > --- a/Documentation/git-shortlog.txt
> > +++ b/Documentation/git-shortlog.txt
> > @@ -76,6 +76,11 @@ them.
> >  Paths may need to be prefixed with `--` to separate them from
> >  options or the revision range, when confusion arises.
> >
> > +In addition to the options above, 'git shortlog' also supports a range of
> > +options to select which subset of commits will be used to generate the
> > +shortlog. A list of these options can be found in the "Commit Limiting"
> > +section of linkgit:git-rev-list[1].
> 
> How does "git log --help" handle the corresponding part of its
> documentation?  
> 
> 	... goes and looks ...
> 
> I wonder if it is better to just include rev-list-options.txt like
> "git-log.txt" does, instead of adding these four lines?
Quoting from my initial email [0] about this topic:
  rev-list-options.txt is a rather large file and I'm not sure if 
  including it in both git-log and git-shortlog would be a good idea. 
  The way I see it, git-log is the "primary" log interface, and 
  git-shortlog is a "secondary" log interface, so git-log warrants such 
  a large man page, but git-shortlog doesn't especially since most 
  options are repeated. So maybe it is a better idea to just include a 
  pointer to git-rev-list in the shortlog man page. 

But if you think including the whole thing is better, I don't mind that either. Will re-roll.

[0] https://public-inbox.org/git/20191024191709.gqkjljuibyashtma@yadavpratyush.com/
-- 
Regards,
Pratyush Yadav
Junio C Hamano· Nov 4, 2019, 03:37 UTC · re: Pratyush Yadav · lore

Re: [PATCH] git-shortlog.txt: mention commit filtering options

Pratyush Yadav <me@yadavpratyush.com> writes:
Show 17 quoted lines
>> How does "git log --help" handle the corresponding part of its
>> documentation?  
>> 
>> 	... goes and looks ...
>> 
>> I wonder if it is better to just include rev-list-options.txt like
>> "git-log.txt" does, instead of adding these four lines?
>
> Quoting from my initial email [0] about this topic:
>
>   rev-list-options.txt is a rather large file and I'm not sure if 
>   including it in both git-log and git-shortlog would be a good idea. 
>   The way I see it, git-log is the "primary" log interface, and 
>   git-shortlog is a "secondary" log interface, so git-log warrants such 
>   a large man page, but git-shortlog doesn't especially since most 
>   options are repeated. So maybe it is a better idea to just include a 
>   pointer to git-rev-list in the shortlog man page. 

OK, so you also wondered the same thing and reached a different conclusion.

Given that
 - "rev-list-options" being large is more or less irrelevant, if you
   want to give users of "short-log" an easy access to these rich
   options.  We already do so for users of "log".
 - "include" files are designed to reduce readers' mental load by
   avoding one level of indirection and also to reduce the risk of
   documentaiton going stale by avoiding repeated text in multiple
   places, and that
 - if description in parts of included file only applies to one
   including file but not others, ifdef/ifndef mechanism can be used
   to customize the contents (see how rev-list-options.txt is
   included in pages for both "log" and "rev-list", and parts of it
   are shown conditionally with "ifndef::git-rev-list[]" and
   friends; diff-options.txt and its users give you more examples to
   follow).
it is not such a bad idea to include the rev-list-options.txt.

More importantly, having a pointer to git-rev-list page may omit what is available to users of "shortlog" (options described inside "ifndef::git-rev-list[]" in rev-list-options.txt are not visible to them) and/or describe what is not available to users of "shortlog" (those described inside "ifdef::git-rev-list[]" may not in general apply to the "log" family of commands).

Thanks.
Pratyush Yadav· Nov 4, 2019, 13:08 UTC · re: Pratyush Yadav · lore

[PATCH v2] git-shortlog.txt: include commit limiting options

git-shortlog, like git-log, supports options to filter what commits are used to generate the log. These options come from git-rev-list, and are documented in Documentation/rev-list-options.txt. Include those options in shortlog's documentation.

But since rev-list-options.txt contains some other options that don't really apply in the context of shortlog (like diff formatting, commit ordering, etc), add a switch in rev-list-options.txt that excludes those sections from the shortlog documentation. To be more specific, include only the "Commit Limiting" section.

Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
---
That ifdef covers almost the entire document. Is there a better way in
Asciidoc to do something like this?
 Documentation/git-shortlog.txt     | 3 +++
 Documentation/rev-list-options.txt | 2 ++
 2 files changed, 5 insertions(+)
Show changes to 2 files +5 −1

Documentation/git-shortlog.txt, Documentation/rev-list-options.txt

diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
index bc80905a8a..a72ea7f7ba 100644
--- a/Documentation/git-shortlog.txt
+++ b/Documentation/git-shortlog.txt
@@ -76,6 +76,9 @@ them.
 Paths may need to be prefixed with `--` to separate them from
 options or the revision range, when confusion arises.

+:git-shortlog: 1
+include::rev-list-options.txt[]
+
 MAPPING AUTHORS
 ---------------

diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 90ff9e2bea..f4b67a917d 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -314,6 +314,7 @@ ifdef::git-rev-list[]
 	`<header>` text will be printed with each progress update.
 endif::git-rev-list[]

+ifndef::git-shortlog[]
 History Simplification
 ~~~~~~~~~~~~~~~~~~~~~~

@@ -1016,3 +1017,4 @@ options may be given. See linkgit:git-diff-files[1] for more options.
 -t::
 	Show the tree objects in the diff output. This implies `-r`.
 endif::git-rev-list[]
+endif::git-shortlog[]
--
2.21.0
Junio C Hamano· Nov 6, 2019, 01:24 UTC · re: Pratyush Yadav · lore

Re: [PATCH v2] git-shortlog.txt: include commit limiting options

Pratyush Yadav <me@yadavpratyush.com> writes:
Show 5 quoted lines
> But since rev-list-options.txt contains some other options that don't
> really apply in the context of shortlog (like diff formatting, commit
> ordering, etc), add a switch in rev-list-options.txt that excludes those
> sections from the shortlog documentation. To be more specific, include
> only the "Commit Limiting" section.

I think this is much better than duplication, and we can improve it further with follow-up patches.

Many options for history simplification are useful for shortlog. I very often use "git shortlog -- cache.h" myself (i.e. limiting to the given pathspec). I suspect most of the "--dashed-options" listed there would make sense for some workflows, even though I do not use them often enough with shortlog. The only exception I can think of that may not be useful at all for the purose of shortlog is "--simplify-by-decoration".

I agree with the patch that all other sections (i.e. bisection helper, commit ordering, object traversal, commit formatting and diff formatting) make little sense to use with shortlog.

> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
> ---
> That ifdef covers almost the entire document. Is there a better way in
> Asciidoc to do something like this?

I would have excluded each section independently with "Heh, this part is not needed for shortlog"; that would make it less error prone against future shuffling of sections in the file.

Thanks.
Pratyush Yadav· Nov 8, 2019, 19:26 UTC · re: Pratyush Yadav · lore

[PATCH v3] git-shortlog.txt: include commit limiting options

git-shortlog, like git-log, supports options to filter what commits are used to generate the log. These options come from git-rev-list, and are documented in Documentation/rev-list-options.txt. Include those options in shortlog's documentation.

But since rev-list-options.txt contains some other options that don't really apply in the context of shortlog (like diff formatting, commit ordering, etc), add a switch in rev-list-options.txt that excludes those sections from the shortlog documentation. To be more specific, include only the "Commit Limiting" and "History Simplification" sections.

Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
---
Changes in v3:
- Include the "History Simplification" section too.
- Wrap each section in an ifdef individually to make it easier to move
  them around later.
 Documentation/git-shortlog.txt     |  3 +++
 Documentation/rev-list-options.txt | 11 ++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
Show changes to 2 files +13 −2

Documentation/git-shortlog.txt, Documentation/rev-list-options.txt

diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
index bc80905a8a..a72ea7f7ba 100644
--- a/Documentation/git-shortlog.txt
+++ b/Documentation/git-shortlog.txt
@@ -76,6 +76,9 @@ them.
 Paths may need to be prefixed with `--` to separate them from
 options or the revision range, when confusion arises.

+:git-shortlog: 1
+include::rev-list-options.txt[]
+
 MAPPING AUTHORS
 ---------------

diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 90ff9e2bea..e37df921b5 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -579,6 +579,7 @@ above) if (1) they are referenced by tags, or (2) they change the
 contents of the paths given on the command line.  All other
 commits are marked as TREESAME (subject to be simplified away).

+ifndef::git-shortlog[]
 ifdef::git-rev-list[]
 Bisection Helpers
 ~~~~~~~~~~~~~~~~~
@@ -634,8 +635,9 @@ This option can be used along with `--bisect-vars`, in this case,
 after all the sorted commit objects, there will be the same text as if
 `--bisect-vars` had been used alone.
 endif::git-rev-list[]
+endif::git-shortlog[]

-
+ifndef::git-shortlog[]
 Commit Ordering
 ~~~~~~~~~~~~~~~

@@ -677,7 +679,9 @@ together.
 	Output the commits chosen to be shown (see Commit Limiting
 	section above) in reverse order. Cannot be combined with
 	`--walk-reflogs`.
+endif::git-shortlog[]

+ifndef::git-shortlog[]
 Object Traversal
 ~~~~~~~~~~~~~~~~

@@ -817,7 +821,9 @@ endif::git-rev-list[]

 --do-walk::
 	Overrides a previous `--no-walk`.
+endif::git-shortlog[]

+ifndef::git-shortlog[]
 Commit Formatting
 ~~~~~~~~~~~~~~~~~

@@ -973,7 +979,9 @@ ifdef::git-rev-list[]
 	counts and print the count for equivalent commits separated
 	by a tab.
 endif::git-rev-list[]
+endif::git-shortlog[]

+ifndef::git-shortlog[]
 ifndef::git-rev-list[]
 Diff Formatting
 ~~~~~~~~~~~~~~~
@@ -1016,3 +1024,4 @@ options may be given. See linkgit:git-diff-files[1] for more options.
 -t::
 	Show the tree objects in the diff output. This implies `-r`.
 endif::git-rev-list[]
+endif::git-shortlog[]
--
2.21.0

← back to recent threads