diff options
author | Junio C Hamano <junkio@cox.net> | 2007-04-03 16:28:46 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-04-03 19:01:36 -0700 |
commit | eb3359663d62f35999330797455dbe738bd5ed99 (patch) | |
tree | ad96b70ce6f5834453867fa4dbd422cc767c09a8 /builtin-rerere.c | |
parent | 3ac53e0d13fa7483cce90eb6a1cfcdcbda5b8e35 (diff) | |
download | git-eb3359663d62f35999330797455dbe738bd5ed99.tar.gz |
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.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin-rerere.c b/builtin-rerere.c index 58c5fed91d..004eda2acd 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) |