diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2011-10-06 12:17:19 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-06 11:16:16 -0700 |
commit | d855e4d35de214e651a62909de96d54915273665 (patch) | |
tree | ad1340b623e49fa1efa0cd9eda33dc9d9938540b /daemon.c | |
parent | ident: check /etc/mailname if email is unknown (diff) | |
download | tgif-d855e4d35de214e651a62909de96d54915273665.tar.xz |
ident: do not retrieve default ident when unnecessary
Avoid a getpwuid() call (which contacts the network if the password
database is not local), read of /etc/mailname, gethostname() call, and
reverse DNS lookup if the user has already chosen a name and email
through configuration, the environment, or the command line.
This should slightly speed up commands like "git commit". More
importantly, it improves error reporting when computation of the
default ident string does not go smoothly. For example, after
detecting a problem (e.g., "warning: cannot open /etc/mailname:
Permission denied") in retrieving the default committer identity:
touch /etc/mailname; # as root
chmod -r /etc/mailname; # as root
git commit -m 'test commit'
you can squelch the warning while waiting for your sysadmin to fix the
permissions problem.
echo '[user] email = me@example.com' >>~/.gitconfig
Inspired-by: Johannes Sixt <j6t@kdgb.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'daemon.c')
0 files changed, 0 insertions, 0 deletions