[PATCH] Do not display 'Switched to a new branch' when the branch existed

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

 



>From cc6410b89b85822aadc5a7843b7398209957e549 Mon Sep 17 00:00:00 2001
From: Tay Ray Chuan <rctay89@xxxxxxxxx>
Date: Thu, 24 Jun 2010 03:29:00 +0800
Subject: [PATCH] builtin/checkout: fix info message for `git checkout <branch>`

Since 02ac98374eefbe4a46d4b53a8a78057ad8ad39b7 `git checkout` would
always display 'Switched to a new branch <branch>` even if the branch
had already existed.

Signed-off-by: Daniel Knittl-Frank <knittl89+git@xxxxxxxxxxxxxx>
---

git checkout should only display 'Switched to a new branch <branch>'
when it creates a new branch, not when it simply switches branches.

ps. I'm not sure about the style used in git for nested ternary
statements (if they should even be used …)

 builtin/checkout.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index 4ad7427..ed7cde1 100644
--- a/builtin/checkout.c
+++ 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" : "",
 					new->name);
 		}
 		if (old->path && old->name) {
-- 
1.7.1.574.g421e3
--
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]