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

Re: [BUG] fatal error during merge

From
Alex Riesen <raa.lkml@gmail.com>
Date
Nov 13, 2008, 23:09 UTC
Message-ID
<20081113230932.GA8552@blimp.localdomain>
In-Reply-To
<20081113180931.GE29274@neumann>
SZEDER Gábor, Thu, Nov 13, 2008 19:09:31 +0100:
Show 14 quoted lines
> On Thu, Nov 13, 2008 at 06:06:52PM +0100, Anders Melchiorsen wrote:
> > SZEDER Gábor wrote:
> > > It doesn't matter.  The test script errors out at the merge, and not
> > > at the checkout.  Furthermore, it doesn't matter, whether HEAD~,
> > > HEAD~, or HEAD^ is checked out, the results are the same.
> > 
> > Just to be sure, I tried reverting the commit that you bisected -- and my
> > test case still fails.
> 
> Well, oddly enough, your second test case behaves somewhat differently
> than the first one, at least as far as bisect is concerned.  Bisect
> nails down the second test case to 0d5e6c97 (Ignore merged status of
> the file-level merge, 2007-04-26; put Alex on Cc).  Reverting this
> commit on master makes both of your test cases pass.
Well, the case is a bit unfair: all files have the same SHA-1!

Whatever, the code pointed by the commit you bisected does look like a problem: it does not update the index after refusing to rewrite the worktree file (because its SHA-1 matches the SHA-1 of the data it would be rewritten with. So updating the file would be a no-op, just wasted effort). Instead of reverting the commit, I suggest the attached patch. It is a long time ago since I looked at the code (and it is a mess, which I'm feeling a bit ashamed of), so another lot of reviewing eyeglasses is definitely in order.

From c395f4234ca5492206923e1821a316a777c651cd Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa.lkml@gmail.com>
Date: Thu, 13 Nov 2008 23:55:04 +0100
Subject: [PATCH] Update index after refusing to rewrite unchanged files

Specifically, which were not changed during recursive merge. Otherwise the path can stay marked as unresolved in the index, causing the merge to fail.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
diff --git a/merge-recursive.c b/merge-recursive.c
index 7472d3e..28f9e12 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -944,14 +944,15 @@ static int process_renames(struct merge_options *o,
 
 				if (mfi.clean &&
 				    sha_eq(mfi.sha, ren1->pair->two->sha1) &&
-				    mfi.mode == ren1->pair->two->mode)
+				    mfi.mode == ren1->pair->two->mode) {
 					/*
 					 * This messaged is part of
 					 * t6022 test. If you change
 					 * it update the test too.
 					 */
 					output(o, 3, "Skipped %s (merged same as existing)", ren1_dst);
-				else {
+					add_cacheinfo(mfi.mode, mfi.sha, ren1_dst, 0, 0, ADD_CACHE_OK_TO_ADD);
+				} else {
 					if (mfi.merge || !mfi.clean)
 						output(o, 1, "Renaming %s => %s", ren1_src, ren1_dst);
 					if (mfi.merge)
Previous: Anders MelchiorsenNext: Anders Melchiorsen
Message 10 of 14 in “[BUG] fatal error during merge”
  1. Anders MelchiorsenNov 13, 2008
  2. Samuel TardieuNov 13, 2008
  3. SZEDER GáborNov 13, 2008
  4. Anders MelchiorsenNov 13, 2008
  5. Samuel TardieuNov 13, 2008
  6. SZEDER GáborNov 13, 2008
  7. Anders MelchiorsenNov 13, 2008
  8. SZEDER GáborNov 13, 2008
  9. Anders MelchiorsenNov 13, 2008
  10. Alex RiesenNov 13, 2008
  11. Anders MelchiorsenNov 13, 2008
  12. Junio C HamanoNov 14, 2008
  13. Alex RiesenNov 14, 2008
  14. Anders MelchiorsenNov 14, 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.