Re: [PATCH re-roll] Do not display 'Switched to a new branch' when the branch existed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, Aug 18, 2010 at 5:16 PM, Jonathan Nieder <jrnieder@xxxxxxxxx> wrote:
> Hi,

Johnathan, thanks for the heads up.

> [snip]
>
> The "From " line and so on output by "git format-patch" are for your
> mailer.  Clarifying From:, Date:, and Subject: lines at the start of
> your message are allowed, though, and can be useful when forwarding
> patches from someone else.

Knittl, I wonder how you generated this patch? Were you working on top
of the "bad" commit?

>> +++ b/builtin/checkout.c
>> @@ -536,7 +536,9 @@ static void update_refs_for_switch(struct
>> checkout_opts *opts,
>>                                       new->name);
>>                       else
>>                               fprintf(stderr, "Switched to%s branch '%s'\n",
>> -                                     opts->branch_exists ? " and reset" : " a new",
>> +                                     opts->branch_exists
>> +                                             ? " and reset"
>> +                                             : opts->new_branch ? " a new" : "",

Strange - I thought I had this sorted out. Thanks for spotting this.

> Maybe it would be clearer to write
>
>        opts->new_branch ? " a new"
>                : opts->branch_exists ? " and reset"
>                : "",
>
> to emphasize that this is a list of condition/result pairs?

We could do with some parentheses - here's my take:

	fprintf(stderr, "Switched to%s branch '%s'\n",
		(opts->branch_exists ? " and reset" :
			(opts->new_branch ? " a new" : "")),
		new->name);

-- 
Cheers,
Ray Chuan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]