aboutsummaryrefslogtreecommitdiff
path: root/builtin-rerere.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-03 16:28:46 -0700
committerJunio C Hamano <junkio@cox.net>2007-04-03 19:01:36 -0700
commiteb3359663d62f35999330797455dbe738bd5ed99 (patch)
treead96b70ce6f5834453867fa4dbd422cc767c09a8 /builtin-rerere.c
parent3ac53e0d13fa7483cce90eb6a1cfcdcbda5b8e35 (diff)
downloadgit-eb3359663d62f35999330797455dbe738bd5ed99.tar.gz
git-eb3359663d62f35999330797455dbe738bd5ed99.tar.xz
rerere should not repeat the earlier hunks in later ones
When a file has more then one conflicting hunks, it repeated the contents of previous hunks in output for later ones. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-rerere.c')
-rw-r--r--builtin-rerere.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin-rerere.c b/builtin-rerere.c
index 58c5fed91..004eda2ac 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -78,6 +78,13 @@ static void append_line(struct buffer *buffer, const char *line)
buffer->nr += len;
}
+static void clear_buffer(struct buffer *buffer)
+{
+ free(buffer->ptr);
+ buffer->ptr = NULL;
+ buffer->nr = buffer->alloc = 0;
+}
+
static int handle_file(const char *path,
unsigned char *sha1, const char *output)
{
@@ -131,6 +138,8 @@ static int handle_file(const char *path,
SHA1_Update(&ctx, two->ptr, two->nr);
SHA1_Update(&ctx, "\0", 1);
}
+ clear_buffer(one);
+ clear_buffer(two);
} else if (hunk == 1)
append_line(one, buf);
else if (hunk == 2)