git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Knittl <knittl89@googlemail.com>
Date
Aug 24, 2010, 06:50 UTC
Message-ID
<AANLkTim7DNasVmaBxWBcUGyGBCZq_HXNdq_=4uKRdxE-@mail.gmail.com>
In-Reply-To
<AANLkTikHbj4zA6Kj0wUp6uQUY3w6cM_z0=Pes1jLLTky@mail.gmail.com>

sorry for the late reply, i hadn't had access to internet for the last week and as it turns i sent my response only to tay

On Wed, Aug 18, 2010 at 3:39 PM, Tay Ray Chuan <rctay89@gmail.com> wrote:
Show 12 quoted lines
> Hi,
>
> On Wed, Aug 18, 2010 at 5:16 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> [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?

yes, i branched off of your bad commit (or rather the commit after your bad commit "fix detached head usage") and created the commit with git commit -c HEAD^ to have the same heading and similar wording without opening a second terminal to copy it over. so i accidentally sent the patch with your name as author, which i then fixed with git amend --reset-author

Show 12 quoted lines
>>> +++ 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.
i tested with next and pu and both tips had the same (confusing) message.
Show 14 quoted lines
>> 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);
that's not really for me to decide, but i'm fine with either version
cheers
-- 
typed with http://neo-layout.org
myFtPhp -- visit http://myftphp.sf.net -- v. 0.4.7 released!
Previous: Tay Ray ChuanNext: Tay Ray Chuan
Message 5 of 10 in “Do not display 'Switched to a new branch' when the branch existed”
  1. Do not display 'Switched to a new branch' when the branch existedKnittl, Aug 18, 2010
  2. Do not display 'Switched to a new branch' when the branch existedKnittl, Aug 18, 2010
  3. Jonathan NiederAug 18, 2010
  4. Tay Ray ChuanAug 18, 2010
  5. KnittlAug 24, 2010
  6. Tay Ray ChuanAug 24, 2010
  7. KnittlAug 25, 2010
  8. Junio C HamanoAug 18, 2010
  9. Junio C HamanoAug 18, 2010
  10. Tay Ray ChuanAug 19, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.