diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2011-10-03 01:16:33 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-03 12:00:44 -0700 |
commit | 8a55caa8a3d9169ba14861b8917e739a50a322fa (patch) | |
tree | e51b60ca46274314707dada7c9529f2a415117f0 /Documentation/git-commit-tree.txt | |
parent | Git 1.7.6 (diff) | |
download | tgif-8a55caa8a3d9169ba14861b8917e739a50a322fa.tar.xz |
ident: check /etc/mailname if email is unknown
Before falling back to gethostname(), check /etc/mailname if
GIT_AUTHOR_EMAIL is not set in the environment or through config
files. Only fall back if /etc/mailname cannot be opened or read.
The /etc/mailname convention comes from Debian policy section 11.6
("mail transport, delivery and user agents"), though maybe it could be
useful sometimes on other machines, too. The lack of this support was
noticed by various people in different ways:
- Ian observed that git was choosing the address
'ian@anarres.relativity.greenend.org.uk' rather than
'ian@davenant.greenend.org.uk' as it should have done.
- Jonathan noticed that operations like "git commit" were needlessly
slow when using a resolver that was slow to handle reverse DNS
lookups.
Alas, after this patch, if /etc/mailname is set up and the [user] name
and email configuration aren't, the committer email will not provide a
charming reminder of which machine commits were made on any more. But
I think it's worth it.
Mechanics: the functionality of reading mailname goes in its own
function, so people who care about other distros can easily add an
implementation to a similar location without making copy_email() too
long and losing clarity. While at it, we split out the fallback
default logic that does gethostname(), too (rearranging it a little
and adding a check for errors from gethostname while at it).
Based on a patch by Gerrit Pape <pape@smarden.org>.
Requested-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-commit-tree.txt')
-rw-r--r-- | Documentation/git-commit-tree.txt | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt index f524d76019..9ac30a3274 100644 --- a/Documentation/git-commit-tree.txt +++ b/Documentation/git-commit-tree.txt @@ -67,7 +67,9 @@ if set: 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, system user name and fully qualified hostname. +present, 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 @@ -89,6 +91,10 @@ Discussion include::i18n.txt[] +FILES +----- +/etc/mailname + SEE ALSO -------- linkgit:git-write-tree[1] |