summaryrefslogtreecommitdiff
path: root/notes-cache.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-12-10 21:41:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-12-14 19:44:38 (GMT)
commit92bcbb9b338dd27f0fd4245525093c4bce867f3d (patch)
tree5056694013c8a91b2618f4e05a1e681417c75acc /notes-cache.c
parent19ce497cf594a3c01af33a65b27b19e7459212d6 (diff)
downloadgit-92bcbb9b338dd27f0fd4245525093c4bce867f3d.zip
git-92bcbb9b338dd27f0fd4245525093c4bce867f3d.tar.gz
git-92bcbb9b338dd27f0fd4245525093c4bce867f3d.tar.bz2
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 'notes-cache.c')
0 files changed, 0 insertions, 0 deletions