[PATCH] builtin/checkout: Fix message when switching to an existing branch

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

 



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@xxxxxxxxx>
Signed-off-by: Ramkumar Ramachandra <artagnon@xxxxxxxxx>
---
 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

--
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]