git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builtin/checkout: Fix message when switching to an existing branch
@ 2010-08-20 17:41 Ramkumar Ramachandra
  2010-08-20 17:46 ` Tay Ray Chuan
  2010-08-21  3:15 ` Tay Ray Chuan
  0 siblings, 2 replies; 6+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-20 17:41 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Tay Ray Chuan, Junio C Hamano

Fix "Switched to a new branch <name>" to read "Switched to branch
<name>" when <name> corresponds to an existing branch. This bug was
introduced in 02ac983 while introducing the `-B` switch.

Cc: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 builtin/checkout.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index 156900d..ff5ac1e 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -545,10 +545,13 @@ static void update_refs_for_switch(struct checkout_opts *opts,
 			if (old->path && !strcmp(new->path, old->path))
 				fprintf(stderr, "Already on '%s'\n",
 					new->name);
-			else
+			else if (opts->new_branch)
 				fprintf(stderr, "Switched to%s branch '%s'\n",
 					opts->branch_exists ? " and reset" : " a new",
 					new->name);
+			else
+				fprintf(stderr, "Switched to branch '%s'\n",
+					new->name);
 		}
 		if (old->path && old->name) {
 			char log_file[PATH_MAX], ref_file[PATH_MAX];
-- 
1.7.2.2.408.g7357

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] builtin/checkout: Fix message when switching to an existing branch
  2010-08-20 17:41 [PATCH] builtin/checkout: Fix message when switching to an existing branch Ramkumar Ramachandra
@ 2010-08-20 17:46 ` Tay Ray Chuan
  2010-08-20 17:49   ` Ramkumar Ramachandra
  2010-08-20 18:17   ` Junio C Hamano
  2010-08-21  3:15 ` Tay Ray Chuan
  1 sibling, 2 replies; 6+ messages in thread
From: Tay Ray Chuan @ 2010-08-20 17:46 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git Mailing List, Junio C Hamano

On Sat, Aug 21, 2010 at 1:41 AM, Ramkumar Ramachandra
<artagnon@gmail.com> wrote:
> Fix "Switched to a new branch <name>" to read "Switched to branch
> <name>" when <name> corresponds to an existing branch. This bug was
> introduced in 02ac983 while introducing the `-B` switch.
>
> Cc: Tay Ray Chuan <rctay89@gmail.com>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>

Please see

  <AANLkTi=3z9gJdT8LL3NANFyppUjvOVcrszjf5J5zAKPe@mail.gmail.com>

-- 
Cheers,
Ray Chuan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] builtin/checkout: Fix message when switching to an existing branch
  2010-08-20 17:46 ` Tay Ray Chuan
@ 2010-08-20 17:49   ` Ramkumar Ramachandra
  2010-08-20 18:17   ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-20 17:49 UTC (permalink / raw)
  To: Tay Ray Chuan; +Cc: Git Mailing List, Junio C Hamano

Hi Tay,

Tay Ray Chuan writes:
> On Sat, Aug 21, 2010 at 1:41 AM, Ramkumar Ramachandra
> <artagnon@gmail.com> wrote:
> > Fix "Switched to a new branch <name>" to read "Switched to branch
> > <name>" when <name> corresponds to an existing branch. This bug was
> > introduced in 02ac983 while introducing the `-B` switch.
> >
> > Cc: Tay Ray Chuan <rctay89@gmail.com>
> > Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> 
> Please see
> 
>   <AANLkTi=3z9gJdT8LL3NANFyppUjvOVcrszjf5J5zAKPe@mail.gmail.com>

Ah yes. It looks like I missed this earlier. Sorry for the noise.

-- Ram

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] builtin/checkout: Fix message when switching to an existing branch
  2010-08-20 17:46 ` Tay Ray Chuan
  2010-08-20 17:49   ` Ramkumar Ramachandra
@ 2010-08-20 18:17   ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2010-08-20 18:17 UTC (permalink / raw)
  To: Tay Ray Chuan; +Cc: Ramkumar Ramachandra, Git Mailing List, Junio C Hamano

Tay Ray Chuan <rctay89@gmail.com> writes:

> On Sat, Aug 21, 2010 at 1:41 AM, Ramkumar Ramachandra
> <artagnon@gmail.com> wrote:
>> Fix "Switched to a new branch <name>" to read "Switched to branch
>> <name>" when <name> corresponds to an existing branch. This bug was
>> introduced in 02ac983 while introducing the `-B` switch.
>>
>> Cc: Tay Ray Chuan <rctay89@gmail.com>
>> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
>
> Please see
>
>   <AANLkTi=3z9gJdT8LL3NANFyppUjvOVcrszjf5J5zAKPe@mail.gmail.com>

Hmm, I somehow find this version easier to read.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] builtin/checkout: Fix message when switching to an existing branch
  2010-08-20 17:41 [PATCH] builtin/checkout: Fix message when switching to an existing branch Ramkumar Ramachandra
  2010-08-20 17:46 ` Tay Ray Chuan
@ 2010-08-21  3:15 ` Tay Ray Chuan
  2010-08-21  3:28   ` Tay Ray Chuan
  1 sibling, 1 reply; 6+ messages in thread
From: Tay Ray Chuan @ 2010-08-21  3:15 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git Mailing List, Junio C Hamano

On Sat, Aug 21, 2010 at 1:41 AM, Ramkumar Ramachandra
<artagnon@gmail.com> wrote:
>  builtin/checkout.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 156900d..ff5ac1e 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -545,10 +545,13 @@ static void update_refs_for_switch(struct checkout_opts *opts,
>                        if (old->path && !strcmp(new->path, old->path))
>                                fprintf(stderr, "Already on '%s'\n",
>                                        new->name);
> -                       else
> +                       else if (opts->new_branch)
>                                fprintf(stderr, "Switched to%s branch '%s'\n",
>                                        opts->branch_exists ? " and reset" : " a new",
>                                        new->name);
> +                       else
> +                               fprintf(stderr, "Switched to branch '%s'\n",
> +                                       new->name);

On a closer reading, I realise that "reset" isn't mentioned if the
branch exists.

The terser ternary version doesn't suffer from this defect.

-- 
Cheers,
Ray Chuan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] builtin/checkout: Fix message when switching to an existing branch
  2010-08-21  3:15 ` Tay Ray Chuan
@ 2010-08-21  3:28   ` Tay Ray Chuan
  0 siblings, 0 replies; 6+ messages in thread
From: Tay Ray Chuan @ 2010-08-21  3:28 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git Mailing List, Junio C Hamano

On Sat, Aug 21, 2010 at 11:15 AM, Tay Ray Chuan <rctay89@gmail.com> wrote:
> On a closer reading, I realise that "reset" isn't mentioned if the
> branch exists.
>
> The terser ternary version doesn't suffer from this defect.

Sorry, please ignore that.

-- 
Cheers,
Ray Chuan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-08-21  3:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-20 17:41 [PATCH] builtin/checkout: Fix message when switching to an existing branch Ramkumar Ramachandra
2010-08-20 17:46 ` Tay Ray Chuan
2010-08-20 17:49   ` Ramkumar Ramachandra
2010-08-20 18:17   ` Junio C Hamano
2010-08-21  3:15 ` Tay Ray Chuan
2010-08-21  3:28   ` Tay Ray Chuan

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 NNTP newsgroup(s).