Re: [PATCH v4 3/3] ident.c: cleanup wrt ident's source
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 4, 2016, 21:33 UTC
- Message-ID
- <xmqqd1scgnyw.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1454577160-24484-4-git-send-email-alonid@gmail.com>
Dan Aloni <alonid@gmail.com> writes:
Show 5 quoted lines
> * 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.
Show 24 quoted lines
>
> Signed-off-by: Dan Aloni <alonid@gmail.com>
> ---
> 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.