ident: keep separate "explicit" flags for author and committer
We keep track of whether the user ident was given to us
explicitly, or if we guessed at it from system parameters
like username and hostname. However, we kept only a single
variable. This covers the common cases (because the author
and committer will usually come from the same explicit
source), but can miss two cases:
1. GIT_COMMITTER_* is set explicitly, but we fallback for
GIT_AUTHOR. We claim the ident is explicit, even though
the author is not.
2. GIT_AUTHOR_* is set and we ask for author ident, but
not committer ident. We will claim the ident is
implicit, even though it is explicit.
This patch uses two variables instead of one, updates both
when we set the "fallback" values, and updates them
individually when we read from the environment.
Rather than keep user_ident_sufficiently_given as a
compatibility wrapper, we update the only two callers to
check the committer_ident, which matches their intent and
what was happening already.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
452802309c
commit
d6991ceedc
@ -755,7 +755,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
||||
ident_shown++ ? "" : "\n",
|
||||
author_ident->buf);
|
||||
|
||||
if (!user_ident_sufficiently_given())
|
||||
if (!committer_ident_sufficiently_given())
|
||||
status_printf_ln(s, GIT_COLOR_NORMAL,
|
||||
_("%s"
|
||||
"Committer: %s"),
|
||||
@ -1265,7 +1265,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1,
|
||||
strbuf_addstr(&format, "\n Author: ");
|
||||
strbuf_addbuf_percentquote(&format, &author_ident);
|
||||
}
|
||||
if (!user_ident_sufficiently_given()) {
|
||||
if (!committer_ident_sufficiently_given()) {
|
||||
strbuf_addstr(&format, "\n Committer: ");
|
||||
strbuf_addbuf_percentquote(&format, &committer_ident);
|
||||
if (advice_implicit_identity) {
|
||||
|
||||
Reference in New Issue
Block a user