Re: [PATCH] rerere should not repeat the earlier hunks in later ones

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, 3 Apr 2007, Junio C Hamano wrote:

> When a file has more then one conflicting hunks, it repeated the
> contents of previous hunks in output for later ones.

/me wonders why our spell-checker has not replied yet: isn't it "than" 
instead of "then"?

> @@ -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)

Ouch. Well spotted, thanks.

I wonder if we should also do

diff --git a/builtin-rerere.c b/builtin-rerere.c
index b8867ab..4eae27b 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -112,7 +112,8 @@ static int handle_file(const char *path,
 		else if (!prefixcmp(buf, ">>>>>>> ")) {
 			hunk_no++;
 			hunk = 0;
-			if (memcmp(one->ptr, two->ptr, one->nr < two->nr ?
+			if (one->nr > two->nr || memcmp(one->ptr, two->ptr,
+						one->nr < two->nr ?
 						one->nr : two->nr) > 0) {
 				struct buffer *swap = one;
 				one = two;

in case that one conflicting region is prefix of the other one.

Ciao,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]