Re: [PATCH] diff: remove ternary operator evaluating always to true

2013-08-12 Thread Junio C Hamano
Stefan Beller writes: > On 08/12/2013 07:46 AM, Junio C Hamano wrote: >> I think that is an overall improvement, especially if we also update >> the checks of {one,two}->mode made for the block that deals with >> submodules to use DIFF_FILE_VALID(). >> >> Thanks. >> > > So, do I understand your

Re: [PATCH] diff: remove ternary operator evaluating always to true

2013-08-12 Thread Stefan Beller
On 08/12/2013 10:32 AM, Stefan Beller wrote: > > diff --git a/diff.c b/diff.c > index e53ddad..de21971 100644 > --- a/diff.c > +++ b/diff.c > @@ -2254,8 +2254,11 @@ static void builtin_diff(const char *name_a, > (!two->mode || S_ISGITLINK(two->mode))) { > const

Re: [PATCH] diff: remove ternary operator evaluating always to true

2013-08-12 Thread Stefan Beller
On 08/12/2013 07:46 AM, Junio C Hamano wrote: > Jeff King writes: > >> On Thu, Aug 08, 2013 at 08:31:44PM +0200, Stefan Beller wrote: >> >>> The next occurrences are at: >>> /* Never use a non-valid filename anywhere if at all possible */ >>> name_a = DIFF_FILE_VALID(one) ? name_a : name_

Re: [PATCH] diff: remove ternary operator evaluating always to true

2013-08-11 Thread Junio C Hamano
Jeff King writes: > On Thu, Aug 08, 2013 at 08:31:44PM +0200, Stefan Beller wrote: > >> The next occurrences are at: >> /* Never use a non-valid filename anywhere if at all possible */ >> name_a = DIFF_FILE_VALID(one) ? name_a : name_b; >> name_b = DIFF_FILE_VALID(two) ? name_b : n

Re: [PATCH] diff: remove ternary operator evaluating always to true

2013-08-10 Thread Jeff King
On Thu, Aug 08, 2013 at 08:31:44PM +0200, Stefan Beller wrote: > The next occurrences are at: > /* Never use a non-valid filename anywhere if at all possible */ > name_a = DIFF_FILE_VALID(one) ? name_a : name_b; > name_b = DIFF_FILE_VALID(two) ? name_b : name_a; > > a_one

[PATCH] diff: remove ternary operator evaluating always to true

2013-08-08 Thread Stefan Beller
The line being changed is deep inside the function builtin_diff. The variable name_b, which is used to evaluate the ternary expression must evaluate to true at that position, hence the replacement with just name_b. The name_b variable only occurs a few times in that lengthy function: As a paramete