git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Tay Ray Chuan <rctay89@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Knittl <knittl89@googlemail.com>, git@vger.kernel.org
Subject: Re: [PATCH re-roll] Do not display 'Switched to a new branch' when the branch existed
Date: Wed, 18 Aug 2010 21:39:20 +0800	[thread overview]
Message-ID: <AANLkTikHbj4zA6Kj0wUp6uQUY3w6cM_z0=Pes1jLLTky@mail.gmail.com> (raw)
In-Reply-To: <20100818091603.GA6263@burratino>

Hi,

On Wed, Aug 18, 2010 at 5:16 PM, Jonathan Nieder <jrnieder@gmail.com> 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

  reply	other threads:[~2010-08-18 13:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-18  8:28 [PATCH] Do not display 'Switched to a new branch' when the branch existed Knittl
2010-08-18  8:38 ` [PATCH re-roll] " Knittl
2010-08-18  9:16   ` Jonathan Nieder
2010-08-18 13:39     ` Tay Ray Chuan [this message]
     [not found]       ` <AANLkTimU75krdgQFvw0fEvAPqJb-eKaPXHg_5Hv2A8wh@mail.gmail.com>
2010-08-19  3:21         ` Tay Ray Chuan
2010-08-24  6:50       ` Knittl
2010-08-24 13:06         ` Tay Ray Chuan
2010-08-25 11:51           ` Knittl
2010-08-18 20:59     ` Junio C Hamano
2010-08-18 23:38       ` Junio C Hamano

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='AANLkTikHbj4zA6Kj0wUp6uQUY3w6cM_z0=Pes1jLLTky@mail.gmail.com' \
    --to=rctay89@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=knittl89@googlemail.com \
    /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).