git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 4, 2007, 15:51 UTC
Message-ID
<Pine.LNX.4.63.0704041746580.4045@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7v1wj1ujf5.fsf@assigned-by-dhcp.cox.net>
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"?

Show 9 quoted lines
> @@ -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
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 7 in “rerere should not repeat the earlier hunks in later ones”
  1. rerere should not repeat the earlier hunks in later onesJunio C Hamano, Apr 3, 2007
  2. Johannes SchindelinApr 4, 2007
  3. Junio C HamanoApr 4, 2007
  4. rerere: make sorting really stable.Junio C Hamano, Apr 4, 2007
  5. Johannes SchindelinApr 4, 2007
  6. Junio C HamanoApr 4, 2007
  7. Johannes SchindelinApr 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.