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

[PATCH] rerere: Fix removal of already resolved path.

From
Junio C Hamano <junkio@cox.net>
Date
Jan 4, 2007, 08:09 UTC
Message-ID
<7vlkkjmcwr.fsf@assigned-by-dhcp.cox.net>

There was an obvious thinko in memmove() to remove an entry that was resolved from the in-core data structure.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * If you were seeing mysterious "Cannot open" messages after
   "git merge", "git rebase", and "git am" runs, this should fix
   them.
 builtin-rerere.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/builtin-rerere.c b/builtin-rerere.c
index 7442498..079c0bd 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -350,11 +350,10 @@ static int do_plain_rerere(struct path_list *rr, int fd)
 		fprintf(stderr, "Recorded resolution for '%s'.\n", path);
 		copy_file(path, rr_path(name, "postimage"));
 tail_optimization:
-		if (i < rr->nr - 1) {
+		if (i < rr->nr - 1)
 			memmove(rr->items + i,
-					rr->items + i + 1,
-					rr->nr - i - 1);
-		}
+				rr->items + i + 1,
+				sizeof(rr->items[0]) * (rr->nr - i - 1));
 		rr->nr--;
 		i--;
 	}
Next: Johannes Schindelin
Message 1 of 2 in “rerere: Fix removal of already resolved path.”
  1. rerere: Fix removal of already resolved path.Junio C Hamano, Jan 4, 2007
  2. Johannes SchindelinJan 4, 2007

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.