threads / patch / 33559

v2, 7 partsDocumentation/shortlog improvements

Subject: [PATCH v2 0/7] Documentation/shortlog improvements

## tl;dr

10 messages between Apr 21, 2013 and Apr 21, 2013. Diffs are folded; open one to read it.

replies: 9people: 2as markdown or json

Ramkumar Ramachandra· Apr 21, 2013, 08:50 UTC · lore
In this round, I've incorporated suggestions made by Junio:
[3/7] is entirely new.

[4/7] and [5/7] together re-order and replace '<since>..<until>' with '<revision range>', in contrast to a single patch which attempted to fix '<since>..<until>' in-place in the previous version.

[6/7] uses "the revision range" instad of "revisions".

[7/7] copies the latest text from git-log.txt, and doesn't attempt to add rev-list-options.txt.

There's a parallel discussion going on about fixing the meaning of "revision", but this series is entirely unrelated to that.

Ramkumar Ramachandra (7):
  git-shortlog.txt: remove (-h|--help) from OPTIONS
  builtin/shortlog.c: make usage string consistent with log
  revisions.txt: clarify the .. and ... syntax
  git-log.txt: order OPTIONS properly; move <since>..<until>
  git-log.txt: generalize <since>..<until>
  git-log.txt: rewrite note on why "--" may be required
  git-shortlog.txt: make SYNOPSIS match log, update OPTIONS
 Documentation/git-log.txt      | 22 ++++++++++++----------
 Documentation/git-shortlog.txt | 25 +++++++++++++++++++------
 Documentation/revisions.txt    |  6 ++++--
 builtin/shortlog.c             |  4 +---
 4 files changed, 36 insertions(+), 21 deletions(-)
-- 
1.8.2.1.501.gd2949c7
Ramkumar Ramachandra· Apr 21, 2013, 08:50 UTC · re: Ramkumar Ramachandra · lore

[PATCH 1/7] git-shortlog.txt: remove (-h|--help) from OPTIONS

To be consistent with the documentation of all the other commands, remove (-h|--help) from the OPTIONS section.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Documentation/git-shortlog.txt | 4 ----
 1 file changed, 4 deletions(-)
Show changes to Documentation/git-shortlog.txt +0 −3
diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
index c308e91..c7f7f51 100644
--- a/Documentation/git-shortlog.txt
+++ b/Documentation/git-shortlog.txt
@@ -26,10 +26,6 @@ reference to the current repository.
 OPTIONS
 -------
 
--h::
---help::
-	Print a short usage message and exit.
-
 -n::
 --numbered::
 	Sort output according to the number of commits per author instead
-- 
1.8.2.1.501.gd2949c7
Ramkumar Ramachandra· Apr 21, 2013, 08:50 UTC · re: Ramkumar Ramachandra · lore

[PATCH 2/7] builtin/shortlog.c: make usage string consistent with log

"--" is used to separate pathspecs from the rev specs, and not rev specs from the options, as the shortlog_usage string currently indicates. In correcting this usage string, make it consistent with the log_usage string.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 builtin/shortlog.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Show changes to builtin/shortlog.c +1 −3
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 240bff3..a2f54f2 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -10,9 +10,7 @@
 #include "parse-options.h"
 
 static char const * const shortlog_usage[] = {
-	N_("git shortlog [-n] [-s] [-e] [-w] [rev-opts] [--] [<commit-id>... ]"),
-	"",
-	N_("[rev-opts] are documented in git-rev-list(1)"),
+	N_("git shortlog [<options>] [<since>..<until>] [[--] [<path>...]]"),
 	NULL
 };
 
-- 
1.8.2.1.501.gd2949c7
Ramkumar Ramachandra· Apr 21, 2013, 08:50 UTC · re: Ramkumar Ramachandra · lore

[PATCH 3/7] revisions.txt: clarify the .. and ... syntax

In <rev1>..<rev2> and <rev1>...<rev2>, if either <rev1> or <rev2> is omitted, it defaults to 'HEAD'. Add this detail to the document.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Documentation/revisions.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Show changes to Documentation/revisions.txt +4 −2
diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt
index 8855b1a..0a23129 100644
--- a/Documentation/revisions.txt
+++ b/Documentation/revisions.txt
@@ -244,11 +244,13 @@ To summarize:
 
 '<rev1>..<rev2>'::
 	Include commits that are reachable from <rev2> but exclude
-	those that are reachable from <rev1>.
+	those that are reachable from <rev1>.  When either <rev1> or
+	<rev2> is omitted, it defaults to 'HEAD'.
 
 '<rev1>\...<rev2>'::
 	Include commits that are reachable from either <rev1> or
-	<rev2> but exclude those that are reachable from both.
+	<rev2> but exclude those that are reachable from both.  When
+	either <rev1> or <rev2> is omitted, it defaults to 'HEAD'.
 
 '<rev>{caret}@', e.g. 'HEAD{caret}@'::
   A suffix '{caret}' followed by an at sign is the same as listing
-- 
1.8.2.1.501.gd2949c7
Ramkumar Ramachandra· Apr 21, 2013, 08:50 UTC · re: Ramkumar Ramachandra · lore

[PATCH 4/7] git-log.txt: order OPTIONS properly; move <since>..<until>

The OPTIONS section lists <since>..<until> as the first item, but this is inconsistent with the ordering in SYNOPSIS. Move it down until it appears just before [[--] <path>...].

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Documentation/git-log.txt | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
Show changes to Documentation/git-log.txt +7 −7
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 69db578..64cc337 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -24,13 +24,6 @@ each commit introduces are shown.
 OPTIONS
 -------
 
-<since>..<until>::
-	Show only commits between the named two commits.  When
-	either <since> or <until> is omitted, it defaults to
-	`HEAD`, i.e. the tip of the current branch.
-	For a more complete list of ways to spell <since>
-	and <until>, see linkgit:gitrevisions[7].
-
 --follow::
 	Continue listing the history of a file beyond renames
 	(works only for a single file).
@@ -69,6 +62,13 @@ produced by --stat etc.
 	Note that only message is considered, if also a diff is shown
 	its size is not included.
 
+<since>..<until>::
+	Show only commits between the named two commits.  When
+	either <since> or <until> is omitted, it defaults to
+	`HEAD`, i.e. the tip of the current branch.
+	For a more complete list of ways to spell <since>
+	and <until>, see linkgit:gitrevisions[7].
+
 [\--] <path>...::
 	Show only commits that are enough to explain how the files
 	that match the specified paths came to be.  See "History
-- 
1.8.2.1.501.gd2949c7
Ramkumar Ramachandra· Apr 21, 2013, 08:50 UTC · re: Ramkumar Ramachandra · lore

[PATCH 5/7] git-log.txt: generalize <since>..<until>

'<since>..<until>' is misleading, as there are many other forms that 'git log' can accept as an argument. Replace it with <revision range>, referring to the section "Specifying Ranges" in revisions.txt, and rewrite the section appropriately.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Documentation/git-log.txt | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
Show changes to Documentation/git-log.txt +9 −7
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 64cc337..c238475 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -9,7 +9,7 @@ git-log - Show commit logs
 SYNOPSIS
 --------
 [verse]
-'git log' [<options>] [<since>..<until>] [[\--] <path>...]
+'git log' [<options>] [<revision range>] [[\--] <path>...]
 
 DESCRIPTION
 -----------
@@ -62,12 +62,14 @@ produced by --stat etc.
 	Note that only message is considered, if also a diff is shown
 	its size is not included.
 
-<since>..<until>::
-	Show only commits between the named two commits.  When
-	either <since> or <until> is omitted, it defaults to
-	`HEAD`, i.e. the tip of the current branch.
-	For a more complete list of ways to spell <since>
-	and <until>, see linkgit:gitrevisions[7].
+<revision range>::
+	Show only commits in the specified revision range.  When no
+	<revision range> is specified, it defaults to 'HEAD' (ie. the
+	whole history leading to the current commit).  master..HEAD
+	specifies all the commits reachable from 'HEAD', but not from
+	'master'. For a complete list of ways to spell
+	<revision range>, see the "Specifying Ranges" section of
+	linkgit:gitrevisions[7].
 
 [\--] <path>...::
 	Show only commits that are enough to explain how the files
-- 
1.8.2.1.501.gd2949c7
Junio C Hamano· Apr 21, 2013, 18:54 UTC · re: Ramkumar Ramachandra · lore

Re: [PATCH 5/7] git-log.txt: generalize <since>..<until>

Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 36 quoted lines
> '<since>..<until>' is misleading, as there are many other forms that
> 'git log' can accept as an argument.  Replace it with <revision range>,
> referring to the section "Specifying Ranges" in revisions.txt, and
> rewrite the section appropriately.
>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  Documentation/git-log.txt | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
> index 64cc337..c238475 100644
> --- a/Documentation/git-log.txt
> +++ b/Documentation/git-log.txt
> @@ -9,7 +9,7 @@ git-log - Show commit logs
>  SYNOPSIS
>  --------
>  [verse]
> -'git log' [<options>] [<since>..<until>] [[\--] <path>...]
> +'git log' [<options>] [<revision range>] [[\--] <path>...]
>  
>  DESCRIPTION
>  -----------
> @@ -62,12 +62,14 @@ produced by --stat etc.
>  	Note that only message is considered, if also a diff is shown
>  	its size is not included.
>  
> -<since>..<until>::
> -	Show only commits between the named two commits.  When
> -	either <since> or <until> is omitted, it defaults to
> -	`HEAD`, i.e. the tip of the current branch.
> -	For a more complete list of ways to spell <since>
> -	and <until>, see linkgit:gitrevisions[7].
> +<revision range>::
> +	Show only commits in the specified revision range.  When no
> +	<revision range> is specified, it defaults to 'HEAD' (ie. the
s/ie/i.e./; or s/ie/meaning /;
Show 5 quoted lines
> +	whole history leading to the current commit).  master..HEAD
> +	specifies all the commits reachable from 'HEAD', but not from
> +	'master'. For a complete list of ways to spell
> +	<revision range>, see the "Specifying Ranges" section of
> +	linkgit:gitrevisions[7].

If you want to have a single example (other than 'HEAD' which has to be there anyway to describe the default), I think it would be more helpful to use one that would be common for not-so-advanced users, e.g. "origin..HEAD", without many other prerequisites (e.g. "@{u}.." may be common among more advanced users but is not appropriate here, because the reader may not have learned @{upstream} or omission of a side of a range defaulting to HEAD).

	... `origin..HEAD` specifies all the commits reachable from
	the current commit (i.e. `HEAD`) but not from `origin`.

I could squash these in locally without a reroll, but I haven't read the remainder of the series yet, so we'll see.

>  [\--] <path>...::
>  	Show only commits that are enough to explain how the files
Ramkumar Ramachandra· Apr 21, 2013, 08:50 UTC · re: Ramkumar Ramachandra · lore

[PATCH 6/7] git-log.txt: rewrite note on why "--" may be required

In its current form, the note talks about separating options from "branch names" and "refnames" in the same sentence. This is entirely inaccurate, as <revision range> need not be a set of branch names or ref names. Rewrite it to use the word "revision range", to be consistent with the SYNOPSIS.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Documentation/git-log.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Show changes to Documentation/git-log.txt +2 −2
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index c238475..7ae21ff 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -77,8 +77,8 @@ produced by --stat etc.
 	Simplification" below for details and other simplification
 	modes.
 +
-To prevent confusion with options and branch names, paths may need to
-be prefixed with "\-- " to separate them from options or refnames.
+Paths may need to be prefixed with "\-- " to separate them from
+options or the revision range, when confusion arises.
 
 include::rev-list-options.txt[]
 
-- 
1.8.2.1.501.gd2949c7
Ramkumar Ramachandra· Apr 21, 2013, 08:50 UTC · re: Ramkumar Ramachandra · lore

[PATCH 7/7] git-shortlog.txt: make SYNOPSIS match log, update OPTIONS

There are broadly two problems with the current SYNOPSIS. First, it completely omits the detail that paths can be specified. Second, it attempts to list all the options: this is futile as, in addition to the options unique to it, it accepts all the options that git-rev-list accepts. In fixing these problems, make the SYNOPSIS consistent with that in git-log.txt. Also add the corresponding sections to OPTIONS. Save adding the options from rev-list-options.txt for a later patch, as it requires some work to pick out the options that are relevant to shortlog.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Documentation/git-shortlog.txt | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
Show changes to Documentation/git-shortlog.txt +19 −2
diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
index c7f7f51..2a66518 100644
--- a/Documentation/git-shortlog.txt
+++ b/Documentation/git-shortlog.txt
@@ -8,8 +8,8 @@ git-shortlog - Summarize 'git log' output
 SYNOPSIS
 --------
 [verse]
-git log --pretty=short | 'git shortlog' [-h] [-n] [-s] [-e] [-w]
-'git shortlog' [-n|--numbered] [-s|--summary] [-e|--email] [-w[<width>[,<indent1>[,<indent2>]]]] <commit>...
+git log --pretty=short | 'git shortlog' [<options>]
+'git shortlog' [<options>] [<revision range>] [[\--] <path>...]
 
 DESCRIPTION
 -----------
@@ -56,6 +56,23 @@ OPTIONS
 If width is `0` (zero) then indent the lines of the output without wrapping
 them.
 
+<revision range>::
+	Consider only commits in the specified revision range.  When no
+	<revision range> is specified, it defaults to 'HEAD' (ie. the
+	whole history leading to the current commit).  master..next
+	specifies all the commits reachable from 'next, but not from
+	'master'. For a complete list of ways to spell
+	<revision range>, see the "Specifying Ranges" section of
+	linkgit:gitrevisions[7].
+
+[\--] <path>...::
+	Consider only commits that are enough to explain how the files
+	that match the specified paths came to be.  See "History
+	Simplification" below for details and other simplification
+	modes.
++
+Paths may need to be prefixed with "\-- " to separate them from
+options or the revision range, when confusion arises.
 
 MAPPING AUTHORS
 ---------------
-- 
1.8.2.1.501.gd2949c7
Junio C Hamano· Apr 21, 2013, 19:06 UTC · re: Ramkumar Ramachandra · lore

Re: [PATCH 7/7] git-shortlog.txt: make SYNOPSIS match log, update OPTIONS

Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 12 quoted lines
> diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
> index c7f7f51..2a66518 100644
> --- a/Documentation/git-shortlog.txt
> +++ b/Documentation/git-shortlog.txt
> @@ -8,8 +8,8 @@ git-shortlog - Summarize 'git log' output
>  SYNOPSIS
>  --------
>  [verse]
> -git log --pretty=short | 'git shortlog' [-h] [-n] [-s] [-e] [-w]
> -'git shortlog' [-n|--numbered] [-s|--summary] [-e|--email] [-w[<width>[,<indent1>[,<indent2>]]]] <commit>...
> +git log --pretty=short | 'git shortlog' [<options>]
> +'git shortlog' [<options>] [<revision range>] [[\--] <path>...]

You will need to update what you added in [PATCH 2/7] to builtin/shortlog.c to match this in this patch.

Show 14 quoted lines
>  DESCRIPTION
>  -----------
> @@ -56,6 +56,23 @@ OPTIONS
>  If width is `0` (zero) then indent the lines of the output without wrapping
>  them.
>  
> +<revision range>::
> +	Consider only commits in the specified revision range.  When no
> +	<revision range> is specified, it defaults to 'HEAD' (ie. the
> +	whole history leading to the current commit).  master..next
> +	specifies all the commits reachable from 'next, but not from
> +	'master'. For a complete list of ways to spell
> +	<revision range>, see the "Specifying Ranges" section of
> +	linkgit:gitrevisions[7].
Match the text you modified in 'log.txt' in [PATCH 5/7], perhaps?
Show 5 quoted lines
> +[\--] <path>...::
> +	Consider only commits that are enough to explain how the files
> +	that match the specified paths came to be.  See "History
> +	Simplification" below for details and other simplification
> +	modes.

Have you read the resulting "git shortlog --help"? Do we even have "below"?

Show 6 quoted lines
> ++
> +Paths may need to be prefixed with "\-- " to separate them from
> +options or the revision range, when confusion arises.
>  
>  MAPPING AUTHORS
>  ---------------

← back to recent threads