builtin/checkout: Fix message when switching to an existing branch
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramkumar Ramachandra committed
Aug 20, 2010 at 23:11 UTC
09a0ec58ce57413dcb2b2cfb4b4ece11ad616e7b
1 file changed
+4
-1
builtin/checkout.c
+4
-1
@@ -533,10 +533,13 @@ static void update_refs_for_switch(struct checkout_opts *opts,
533
if (old->path && !strcmp(new->path, old->path))
534
fprintf(stderr, "Already on '%s'\n",
535
new->name);
536
- else
536
+ else if (opts->new_branch)
537
fprintf(stderr, "Switched to%s branch '%s'\n",
538
opts->branch_exists ? " and reset" : " a new",
539
new->name);
540
+ else
541
+ fprintf(stderr, "Switched to branch '%s'\n",
542
+ new->name);
543
}
544
if (old->path && old->name) {
545
char log_file[PATH_MAX], ref_file[PATH_MAX];