diff mbox series

[v4,1/5] doc: move author and committer information to git-commit(1)

Message ID 20200120173343.4102954-2-sandals@crustytoothpaste.net (mailing list archive)
State New, archived
Headers show
Series Documentation for common user misconceptions | expand

Commit Message

brian m. carlson Jan. 20, 2020, 5:33 p.m. UTC
While at one time it made perfect sense to store information about
configuring author and committer information in the documentation for
git commit-tree, in modern Git that operation is seldom used.  Most
users will use git commit and expect to find comprehensive documentation
about its use in the manual page for that command.

Considering that there is significant confusion about how one is to use
the user.name and user.email variables, let's put as much documentation
as possible into an obvious place where users will be more likely to
find it.

In addition, expand the environment variables section to describe their
use more fully.  Even though we now describe all of the options there
and in the configuration settings documentation, preserve the existing
text in git-commit.txt so that people can easily reason about the
ordering of the various options they can use.  Explain the use of the
author.* and committer.* options as well.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 Documentation/config/user.txt     |  2 +-
 Documentation/git-commit-tree.txt | 26 +++++---------------------
 Documentation/git-commit.txt      | 27 ++++++++++++++++++++++++---
 Documentation/git.txt             | 27 +++++++++++++++++++++++++--
 4 files changed, 55 insertions(+), 27 deletions(-)

Comments

Jeff King Jan. 20, 2020, 5:52 p.m. UTC | #1
On Mon, Jan 20, 2020 at 05:33:39PM +0000, brian m. carlson wrote:

> diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt
> index 4b90b9c12a..adc2e0d4b7 100644
> --- a/Documentation/git-commit-tree.txt
> +++ b/Documentation/git-commit-tree.txt
> @@ -42,6 +42,10 @@ tend to just write the result to the file that is pointed at by
>  `.git/HEAD`, so that we can always see what the last committed
>  state was.
>  
> +A commit comment is read from stdin. If a changelog
> +entry is not provided via "<" redirection, 'git commit-tree' will just wait
> +for one to be entered and terminated with ^D.
> +
>  OPTIONS
>  -------
>  <tree>::

This text got moved up, which kind of make sense to me, but...

> @@ -79,26 +82,6 @@ A commit encapsulates:
>  - author name, email and date
>  - committer name and email and the commit time.
>  
> -While parent object ids are provided on the command line, author and
> -committer information is taken from the following environment variables,
> -if set:
> -
> -	GIT_AUTHOR_NAME
> -	GIT_AUTHOR_EMAIL
> -	GIT_AUTHOR_DATE
> -	GIT_COMMITTER_NAME
> -	GIT_COMMITTER_EMAIL
> -	GIT_COMMITTER_DATE
> -
> -(nb "<", ">" and "\n"s are stripped)
> -
> -In case (some of) these environment variables are not set, the information
> -is taken from the configuration items user.name and user.email, or, if not
> -present, the environment variable EMAIL, or, if that is not set,
> -system user name and the hostname used for outgoing mail (taken
> -from `/etc/mailname` and falling back to the fully qualified hostname when
> -that file does not exist).
> -
>  A commit comment is read from stdin. If a changelog
>  entry is not provided via "<" redirection, 'git commit-tree' will just wait
>  for one to be entered and terminated with ^D.

it stayed here, so now it's duplicated. Should the old one be dropped?
Or is moving the new text a leftover mistake from rebasing (IIRC, in
your original you dropped this whole "here's how commits work" section).

Other than that, the patch looks good to me.

-Peff
brian m. carlson Jan. 20, 2020, 7:22 p.m. UTC | #2
On 2020-01-20 at 17:52:10, Jeff King wrote:
> On Mon, Jan 20, 2020 at 05:33:39PM +0000, brian m. carlson wrote:
> 
> > diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt
> > index 4b90b9c12a..adc2e0d4b7 100644
> > --- a/Documentation/git-commit-tree.txt
> > +++ b/Documentation/git-commit-tree.txt
> > @@ -42,6 +42,10 @@ tend to just write the result to the file that is pointed at by
> >  `.git/HEAD`, so that we can always see what the last committed
> >  state was.
> >  
> > +A commit comment is read from stdin. If a changelog
> > +entry is not provided via "<" redirection, 'git commit-tree' will just wait
> > +for one to be entered and terminated with ^D.
> > +
> >  OPTIONS
> >  -------
> >  <tree>::
> 
> This text got moved up, which kind of make sense to me, but...
> 
> it stayed here, so now it's duplicated. Should the old one be dropped?
> Or is moving the new text a leftover mistake from rebasing (IIRC, in
> your original you dropped this whole "here's how commits work" section).
> 
> Other than that, the patch looks good to me.

Thanks for pointing this out.  I'll fix it and if nobody else has
comments today, send out a v5 later this week, probably tomorrow.
Junio C Hamano Jan. 21, 2020, 10:23 p.m. UTC | #3
"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> diff --git a/Documentation/config/user.txt b/Documentation/config/user.txt
> index 0557cbbceb..a1f80e823c 100644
> --- a/Documentation/config/user.txt
> +++ b/Documentation/config/user.txt
> @@ -13,7 +13,7 @@ committer.email::
>  	Also, all of these can be overridden by the `GIT_AUTHOR_NAME`,
>  	`GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`,
>  	`GIT_COMMITTER_EMAIL` and `EMAIL` environment variables.
> -	See linkgit:git-commit-tree[1] for more information.
> +	See linkgit:git-commit[1] for more information.

Makes sense---it is consistent with the goal of making the
documentation of "git commit" Porcelain the central place for
authorship and committer information.

> diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt
> index 4b90b9c12a..adc2e0d4b7 100644
> --- a/Documentation/git-commit-tree.txt
> +++ b/Documentation/git-commit-tree.txt
> @@ -42,6 +42,10 @@ tend to just write the result to the file that is pointed at by
>  `.git/HEAD`, so that we can always see what the last committed
>  state was.
>  
> +A commit comment is read from stdin. If a changelog
> +entry is not provided via "<" redirection, 'git commit-tree' will just wait
> +for one to be entered and terminated with ^D.

This is copied from the end of the "commit information" section,
without the original getting removed (see the post-context of the
hunk that begins at l.79/l.82).  Intended?

I haven't seen anybody use the phrase "commit comment" in the
reviews on this list for long time; the phrase somehow feels
outdated.  The pretty formats section in "git log --help" calls
this "commit message".  "log message" may also be more common.

> @@ -69,7 +73,6 @@ OPTIONS
>  	Do not GPG-sign commit, to countermand a `--gpg-sign` option
>  	given earlier on the command line.
>  
> -
>  Commit Information
>  ------------------
>  
> @@ -79,26 +82,6 @@ A commit encapsulates:
>  - author name, email and date
>  - committer name and email and the commit time.
>  
> -While parent object ids are provided on the command line, author and
> -...
> -that file does not exist).
> -
>  A commit comment is read from stdin. If a changelog
>  entry is not provided via "<" redirection, 'git commit-tree' will just wait
>  for one to be entered and terminated with ^D.
> @@ -117,6 +100,7 @@ FILES
Junio C Hamano Jan. 21, 2020, 10:24 p.m. UTC | #4
Jeff King <peff@peff.net> writes:

>>  A commit comment is read from stdin. If a changelog
>>  entry is not provided via "<" redirection, 'git commit-tree' will just wait
>>  for one to be entered and terminated with ^D.
>
> it stayed here, so now it's duplicated. Should the old one be dropped?
> Or is moving the new text a leftover mistake from rebasing (IIRC, in
> your original you dropped this whole "here's how commits work" section).

Ah, you spotted the same thing.
diff mbox series

Patch

diff --git a/Documentation/config/user.txt b/Documentation/config/user.txt
index 0557cbbceb..a1f80e823c 100644
--- a/Documentation/config/user.txt
+++ b/Documentation/config/user.txt
@@ -13,7 +13,7 @@  committer.email::
 	Also, all of these can be overridden by the `GIT_AUTHOR_NAME`,
 	`GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`,
 	`GIT_COMMITTER_EMAIL` and `EMAIL` environment variables.
-	See linkgit:git-commit-tree[1] for more information.
+	See linkgit:git-commit[1] for more information.
 
 user.useConfigOnly::
 	Instruct Git to avoid trying to guess defaults for `user.email`
diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt
index 4b90b9c12a..adc2e0d4b7 100644
--- a/Documentation/git-commit-tree.txt
+++ b/Documentation/git-commit-tree.txt
@@ -42,6 +42,10 @@  tend to just write the result to the file that is pointed at by
 `.git/HEAD`, so that we can always see what the last committed
 state was.
 
+A commit comment is read from stdin. If a changelog
+entry is not provided via "<" redirection, 'git commit-tree' will just wait
+for one to be entered and terminated with ^D.
+
 OPTIONS
 -------
 <tree>::
@@ -69,7 +73,6 @@  OPTIONS
 	Do not GPG-sign commit, to countermand a `--gpg-sign` option
 	given earlier on the command line.
 
-
 Commit Information
 ------------------
 
@@ -79,26 +82,6 @@  A commit encapsulates:
 - author name, email and date
 - committer name and email and the commit time.
 
-While parent object ids are provided on the command line, author and
-committer information is taken from the following environment variables,
-if set:
-
-	GIT_AUTHOR_NAME
-	GIT_AUTHOR_EMAIL
-	GIT_AUTHOR_DATE
-	GIT_COMMITTER_NAME
-	GIT_COMMITTER_EMAIL
-	GIT_COMMITTER_DATE
-
-(nb "<", ">" and "\n"s are stripped)
-
-In case (some of) these environment variables are not set, the information
-is taken from the configuration items user.name and user.email, or, if not
-present, the environment variable EMAIL, or, if that is not set,
-system user name and the hostname used for outgoing mail (taken
-from `/etc/mailname` and falling back to the fully qualified hostname when
-that file does not exist).
-
 A commit comment is read from stdin. If a changelog
 entry is not provided via "<" redirection, 'git commit-tree' will just wait
 for one to be entered and terminated with ^D.
@@ -117,6 +100,7 @@  FILES
 SEE ALSO
 --------
 linkgit:git-write-tree[1]
+linkgit:git-commit[1]
 
 GIT
 ---
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index ced5a9beab..30c30ccd80 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -367,9 +367,6 @@  changes to tracked files.
 +
 For more details, see the 'pathspec' entry in linkgit:gitglossary[7].
 
-:git-commit: 1
-include::date-formats.txt[]
-
 EXAMPLES
 --------
 When recording your own work, the contents of modified files in
@@ -463,6 +460,30 @@  alter the order the changes are committed, because the merge
 should be recorded as a single commit.  In fact, the command
 refuses to run when given pathnames (but see `-i` option).
 
+COMMIT INFORMATION
+------------------
+
+Author and committer information is taken from the following environment
+variables, if set:
+
+	GIT_AUTHOR_NAME
+	GIT_AUTHOR_EMAIL
+	GIT_AUTHOR_DATE
+	GIT_COMMITTER_NAME
+	GIT_COMMITTER_EMAIL
+	GIT_COMMITTER_DATE
+
+(nb "<", ">" and "\n"s are stripped)
+
+In case (some of) these environment variables are not set, the information
+is taken from the configuration items `user.name` and `user.email`, or, if not
+present, the environment variable EMAIL, or, if that is not set,
+system user name and the hostname used for outgoing mail (taken
+from `/etc/mailname` and falling back to the fully qualified hostname when
+that file does not exist).
+
+:git-commit: 1
+include::date-formats.txt[]
 
 DISCUSSION
 ----------
diff --git a/Documentation/git.txt b/Documentation/git.txt
index b1597ac002..0093c647bf 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -482,13 +482,36 @@  double-quotes and respecting backslash escapes. E.g., the value
 Git Commits
 ~~~~~~~~~~~
 `GIT_AUTHOR_NAME`::
+	The human-readable name used in the author identity when creating commit or
+	tag objects, or when writing reflogs. Overrides the `user.name` and
+	`author.name` configuration settings.
+
 `GIT_AUTHOR_EMAIL`::
+	The email address used in the author identity when creating commit or
+	tag objects, or when writing reflogs. Overrides the `user.email` and
+	`author.email` configuration settings.
+
 `GIT_AUTHOR_DATE`::
+	The date used for the author identity when creating commit or tag objects, or
+	when writing reflogs. See linkgit:git-commit[1] for valid formats.
+
 `GIT_COMMITTER_NAME`::
+	The human-readable name used in the committer identity when creating commit or
+	tag objects, or when writing reflogs. Overrides the `user.name` and
+	`committer.name` configuration settings.
+
 `GIT_COMMITTER_EMAIL`::
+	The email address used in the author identity when creating commit or
+	tag objects, or when writing reflogs. Overrides the `user.email` and
+	`committer.email` configuration settings.
+
 `GIT_COMMITTER_DATE`::
-'EMAIL'::
-	see linkgit:git-commit-tree[1]
+	The date used for the committer identity when creating commit or tag objects, or
+	when writing reflogs. See linkgit:git-commit[1] for valid formats.
+
+`EMAIL`::
+	The email address used in the author and committer identities if no other
+	relevant environment variable or configuration setting has been set.
 
 Git Diffs
 ~~~~~~~~~