diff options
author | Thomas Gummerer <t.gummerer@gmail.com> | 2019-03-06 23:09:11 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-03-07 01:41:40 +0100 |
commit | 0640897dc5ff1f75308d3ebb45e152aed40bb9a3 (patch) | |
tree | 821aef5beab5ca9ddc446fa2dacf935c97eb3097 /ident.c | |
parent | ident: add the ability to provide a "fallback identity" (diff) | |
download | git-0640897dc5ff1f75308d3ebb45e152aed40bb9a3.tar.xz git-0640897dc5ff1f75308d3ebb45e152aed40bb9a3.zip |
ident: don't require calling prepare_fallback_ident first
In fd5a58477c ("ident: add the ability to provide a "fallback
identity"", 2019-02-25) I made it a requirement to call
prepare_fallback_ident as the first function in the ident API.
However in stash we didn't actually end up following that.
This leads to a BUG if user.email and user.name are set. It was not
caught in the test suite because we only rely on environment variables
for setting the user name and email instead of the config.
Instead of making it a bug to call other functions in the ident API
first, just return silently if the identity of a user was already set
up.
Reported-by: Denton Liu <liu.denton@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ident.c')
-rw-r--r-- | ident.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -507,9 +507,7 @@ int git_ident_config(const char *var, const char *value, void *data) static void set_env_if(const char *key, const char *value, int *given, int bit) { - if (*given & bit) - BUG("%s was checked before prepare_fallback got called", key); - if (getenv(key)) + if ((*given & bit) || getenv(key)) return; /* nothing to do */ setenv(key, value, 0); *given |= bit; |