From: Knittl <knittl89@googlemail.com>
To: git@vger.kernel.org
Subject: [PATCH] Do not display 'Switched to a new branch' when the branch existed
Date: Wed, 18 Aug 2010 10:28:26 +0200 [thread overview]
Message-ID: <AANLkTimaZF1Q6BPB7CN0Wa5-Ov2ejVfPsmL34vps2VqK@mail.gmail.com> (raw)
From cc6410b89b85822aadc5a7843b7398209957e549 Mon Sep 17 00:00:00 2001
From: Tay Ray Chuan <rctay89@gmail.com>
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@googlemail.com>
---
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
next reply other threads:[~2010-08-18 8:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-18 8:28 Knittl [this message]
2010-08-18 8:38 ` [PATCH re-roll] Do not display 'Switched to a new branch' when the branch existed Knittl
2010-08-18 9:16 ` Jonathan Nieder
2010-08-18 13:39 ` Tay Ray Chuan
[not found] ` <AANLkTimU75krdgQFvw0fEvAPqJb-eKaPXHg_5Hv2A8wh@mail.gmail.com>
2010-08-19 3:21 ` Tay Ray Chuan
2010-08-24 6:50 ` Knittl
2010-08-24 13:06 ` Tay Ray Chuan
2010-08-25 11:51 ` Knittl
2010-08-18 20:59 ` Junio C Hamano
2010-08-18 23:38 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTimaZF1Q6BPB7CN0Wa5-Ov2ejVfPsmL34vps2VqK@mail.gmail.com \
--to=knittl89@googlemail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).