Skip to contentSkip to conversation

rerere: Fix removal of already resolved path.

PATCH In review Junio C Hamano 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rerere: Fix removal of already resolved path.

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

---

* 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(-)
builtin-rerere.c +3 -4
index 7442498..079c0bd 100644
@@ -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--;
 	}
#1 lore raw

Hi,

Quoted 2 lines · Junio C Hamano

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

I keep making the same errors, don't I?

Sorry,
Dscho