git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: git@vger.kernel.org, Johan Herland <johan@herland.net>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: Re: [PATCH v2] make color.ui default to 'auto'
Date: Wed, 15 May 2013 10:30:13 -0700	[thread overview]
Message-ID: <7vd2sscfru.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <vpq61ykfang.fsf@grenoble-inp.fr> (Matthieu Moy's message of "Wed, 15 May 2013 18:52:35 +0200")

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> Junio C Hamano <gitster@pobox.com> writes:
>
>> Matthieu Moy <Matthieu.Moy@imag.fr> writes:
>>
>>> diff --git a/builtin/config.c b/builtin/config.c
>>> index 000d27c..ecfceca 100644
>>> --- a/builtin/config.c
>>> +++ b/builtin/config.c
>>> @@ -316,7 +316,7 @@ static void get_color(const char *def_color)
>>>  
>>>  static int get_colorbool_found;
>>>  static int get_diff_color_found;
>>> -static int get_color_ui_found;
>>> +static int get_color_ui_found = GIT_COLOR_AUTO;
>>
>> It is curious to notice that we have these three and only one is
>> initialized to the new default value, while the other two get -1
>> at the beginning of get_colorbool().
>
> Right. The meaning of the _found suffix is clear for the first two, but
> not the last.
>
>> I wonder if it would be cleaner to statically initialize all three
>> to -1 here, drop the assignment of -1 to two of them from the
>> beginning of get_colorbool(), and then have a final fallback inside
>> the want_color() call itself, i.e.
>
> I've left the assignments within the function (I like the initialisation
> right before usage, I don't have to worry about how many times the
> function is called then), but I've added a patch that initializes
> get_color_ui_found to -1 like the others, and does essentially this:
>
>> 	get_colorbool_found = want_color(get_colorbool_found < 0
>>         				? GIT_COLOR_AUTO
>>                                         : get_colorbool_found);
>
> Except I've made it a separate if statement. Then PATCH 2/2 is really
> crystal clear.

Yeah, sounds good.

> Reroll comming, with an improved commit message that should adress the
> points in the other message.

Hmm, I don't see much improvement in the message, though.  It seems
to talk about "may not discover", "live with", "a few people", and
"they can easily", none of which should be there.

  parent reply	other threads:[~2013-05-15 17:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-15  6:23 is this a bug of git-diff? eric liou
2013-05-15  6:43 ` Antoine Pelisse
     [not found]   ` <CABwUO_Wyq34S=CwbLeAqmzaFLxORkvGEvrjUzMXjkJdE1jnbhA@mail.gmail.com>
2013-05-15  7:10     ` Antoine Pelisse
2013-05-15  9:34       ` Matthieu Moy
2013-05-15  9:50         ` John Keeping
2013-05-15 10:03           ` Default for color.ui (was Re: is this a bug of git-diff?) Matthieu Moy
2013-05-15 10:37             ` Felipe Contreras
2013-05-15 12:09             ` [PATCH] make color.ui default to 'auto' Matthieu Moy
2013-05-15 12:59               ` Johan Herland
2013-05-15 13:21                 ` [PATCH v2] " Matthieu Moy
2013-05-15 16:09                   ` Junio C Hamano
2013-05-15 16:52                     ` Matthieu Moy
2013-05-15 17:00                       ` [PATCH 1/2] config: refactor management of color.ui's default value Matthieu Moy
2013-05-15 17:00                         ` [PATCH 2/2 v4] make color.ui default to 'auto' Matthieu Moy
2013-05-15 17:30                       ` Junio C Hamano [this message]
2013-05-15 13:20               ` [PATCH] " Stefano Lattarini
2013-05-15 14:24                 ` [PATCH v3] " Matthieu Moy
2013-05-15 15:42               ` [PATCH] " Junio C Hamano
2013-05-15 16:27                 ` Matthieu Moy
2013-05-15 17:34                   ` Junio C Hamano
2013-05-15 17:56                     ` Matthieu Moy
2013-05-15 18:08                       ` Junio C Hamano
2013-05-15 18:21                         ` Matthieu Moy
2013-05-15 18:32                           ` Junio C Hamano
2013-05-15 19:41                             ` Felipe Contreras
2013-05-15 16:43                 ` John Keeping
2013-05-15 10:31           ` is this a bug of git-diff? Mike Hommey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vd2sscfru.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johan@herland.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).