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

2 messages from 2007-01-04 to 2007-01-04. Participants: Junio C Hamano, Johannes Schindelin.
Thread: https://gitlist.dev/t/6217

## Junio C Hamano, 2007-01-04 08:09

Subject: [PATCH] rerere: Fix removal of already resolved path.
Message-ID: <7vlkkjmcwr.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vlkkjmcwr.fsf%40assigned-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--;
 	}

```

## Johannes Schindelin, 2007-01-04 09:03

Subject: Re: [PATCH] rerere: Fix removal of already resolved path.
Message-ID: <Pine.LNX.4.63.0701041003040.22628@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0701041003040.22628%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <7vlkkjmcwr.fsf@assigned-by-dhcp.cox.net>

```
Hi,

On Thu, 4 Jan 2007, Junio C Hamano wrote:

> 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

```
