diff options
author | Jeff King <peff@peff.net> | 2015-12-10 16:41:29 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-12-14 11:44:38 -0800 |
commit | 92bcbb9b338dd27f0fd4245525093c4bce867f3d (patch) | |
tree | 5056694013c8a91b2618f4e05a1e681417c75acc /t/t4013/diff.log_master | |
parent | ident: keep a flag for bogus default_email (diff) | |
download | tgif-92bcbb9b338dd27f0fd4245525093c4bce867f3d.tar.xz |
ident: loosen getpwuid error in non-strict mode
If the user has not specified an identity and we have to
turn to getpwuid() to find the username or gecos field, we
die immediately when getpwuid fails (e.g., because the user
does not exist). This is OK for making a commit, where we
have set IDENT_STRICT and would want to bail on bogus input.
But for something like a reflog, where the ident is "best
effort", it can be pain. For instance, even running "git
clone" with a UID that is not in /etc/passwd will result in
git barfing, just because we can't find an ident to put in
the reflog.
Instead of dying in xgetpwuid_self, we can instead return a
fallback value, and set a "bogus" flag. For the username in
an email, we already have a "default_email_is_bogus" flag.
For the name field, we introduce (and check) a matching
"default_name_is_bogus" flag. As a bonus, this means you now
get the usual "tell me who you are" advice instead of just a
"no such user" error.
No tests, as this is dependent on configuration outside of
git's control. However, I did confirm that it behaves
sensibly when I delete myself from the local /etc/passwd
(reflogs get written, and commits complain).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.log_master')
0 files changed, 0 insertions, 0 deletions