git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Knittl <knittl89@googlemail.com>
Date
Aug 18, 2010, 08:38 UTC
Message-ID
<AANLkTi=3z9gJdT8LL3NANFyppUjvOVcrszjf5J5zAKPe@mail.gmail.com>
In-Reply-To
<AANLkTimaZF1Q6BPB7CN0Wa5-Ov2ejVfPsmL34vps2VqK@mail.gmail.com>
From 16f540c87f8c7b87692dfd488d507802ae975312 Mon Sep 17 00:00:00 2001
From: Daniel Knittl-Frank <knittl89+git@googlemail.com>
Date: Wed, 18 Aug 2010 10:35:42 +0200
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>
---
stupid me, i forgot to reset author in re-used commit …
 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


-- 
typed with http://neo-layout.org
myFtPhp -- visit http://myftphp.sf.net -- v. 0.4.7 released!
Previous: KnittlNext: Jonathan Nieder
Message 2 of 10 in “Do not display 'Switched to a new branch' when the branch existed”
  1. Do not display 'Switched to a new branch' when the branch existedKnittl, Aug 18, 2010
  2. Do not display 'Switched to a new branch' when the branch existedKnittl, Aug 18, 2010
  3. Jonathan NiederAug 18, 2010
  4. Tay Ray ChuanAug 18, 2010
  5. KnittlAug 24, 2010
  6. Tay Ray ChuanAug 24, 2010
  7. KnittlAug 25, 2010
  8. Junio C HamanoAug 18, 2010
  9. Junio C HamanoAug 18, 2010
  10. Tay Ray ChuanAug 19, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.