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

[PATCH] checkout: error out when index is unmerged even with -m

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 23, 2008, 23:45 UTC
Message-ID
<7voda7xmnk.fsf_-_@gitster.siamese.dyndns.org>
In-Reply-To
<7vzltrz4cl.fsf@gitster.siamese.dyndns.org>

Even when -m is given to allow fallilng back to 3-way merge while switching branches, we should refuse if the original index is unmerged.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * I think this bug was inherited from the scripted version.
   Fixing it is much easier here.
 builtin-checkout.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin-checkout.c b/builtin-checkout.c
index 283831e..e028270 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -226,8 +226,8 @@ static int merge_working_tree(struct checkout_opts *opts,
 		refresh_cache(REFRESH_QUIET);
 
 		if (unmerged_cache()) {
-			ret = opts->merge ? -1 :
-				error("you need to resolve your current index first");
+			error("you need to resolve your current index first");
+			return 1;
 		} else {
 			topts.update = 1;
 			topts.merge = 1;
Previous: Junio C HamanoNext: Daniel Barkalow
Message 6 of 7 in “Be more verbose when checkout takes a long time”
  1. Linus TorvaldsFeb 23, 2008
  2. Junio C HamanoFeb 23, 2008
  3. Linus TorvaldsFeb 23, 2008
  4. Junio C HamanoFeb 23, 2008
  5. Junio C HamanoFeb 23, 2008
  6. checkout: error out when index is unmerged even with -mJunio C Hamano, Feb 23, 2008
  7. Daniel BarkalowFeb 24, 2008

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.