Re: [PATCH v4 3/3] ident.c: cleanup wrt ident's source
From: Junio C Hamano <hidden>
Date: 2016-06-15 23:08:06
Dan Aloni [off-list ref] writes:
* Condense the variables that tells where we got the user's
ident into single enum, instead of a collection of booleans.
* Have {committer,author}_ident_sufficiently_given directly
probe the environment and the afformentioned enum instead of
relying on git_{committer,author}_info to do so.That looks quite different from how we write our proposed log messages.
quoted hunk
Signed-off-by: Dan Aloni <redacted> --- ident.c | 122 ++++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 77 insertions(+), 45 deletions(-)diff --git a/ident.c b/ident.c index 1216079d0b0d..b9aad38e0621 100644 --- a/ident.c +++ b/ident.c@@ -10,17 +10,19 @@ static struct strbuf git_default_name = STRBUF_INIT; static struct strbuf git_default_email = STRBUF_INIT; static struct strbuf git_default_date = STRBUF_INIT; -static int default_email_is_bogus; -static int default_name_is_bogus; + +enum ident_source { + IDENT_SOURCE_UNKNOWN = 0, + IDENT_SOURCE_CONFIG, + IDENT_SOURCE_ENVIRONMENT, + IDENT_SOURCE_GUESSED, + IDENT_SOURCE_GUESSED_BOGUS, +};
No trailing comma after the last enum (some compliers choke on this IIRC). I skimmed the remainder of the patch but I am no the fence--I cannot quite see how this improves the readability of the result. Thanks.