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

Re: limiting rename detection during merge is a really bad idea

From
Jeff King <peff@peff.net>
Date
Feb 11, 2008, 11:40 UTC
Message-ID
<20080211114050.GC6344@coredump.intra.peff.net>
In-Reply-To
<8aa486160802110320h78f7228fg84ae2c4986f67372@mail.gmail.com>
On Mon, Feb 11, 2008 at 12:20:37PM +0100, Santi Béjar wrote:
> Additionally git could warn if the limit is reached in the merge.

I think that is reasonable. It feels a little wrong, though, to be spewing user messages from such a deep library-ish function (and those messages will probably be lost for commands with a pager). But something like this?

---
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 3d37725..31941bc 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -468,10 +468,11 @@ void diffcore_rename(struct diff_options *options)
 	 */
 	if (rename_limit <= 0 || rename_limit > 32767)
 		rename_limit = 32767;
-	if (num_create > rename_limit && num_src > rename_limit)
-		goto cleanup;
-	if (num_create * num_src > rename_limit * rename_limit)
+	if ((num_create > rename_limit && num_src > rename_limit) ||
+	    (num_create * num_src > rename_limit * rename_limit)) {
+		warning("too many files, skipping inexact rename detection");
 		goto cleanup;
+	}
 
 	mx = xmalloc(sizeof(*mx) * num_create * num_src);
 	for (dst_cnt = i = 0; i < rename_dst_nr; i++) {
Previous: Santi BéjarNext: Steffen Prohaska
Message 9 of 11 in “limiting rename detection during merge is a really bad idea”
  1. Steffen ProhaskaFeb 11, 2008
  2. Marco CostalbaFeb 11, 2008
  3. Jeff KingFeb 11, 2008
  4. Marco CostalbaFeb 11, 2008
  5. Jeff KingFeb 11, 2008
  6. Lars HjemliFeb 11, 2008
  7. Jeff KingFeb 11, 2008
  8. Santi BéjarFeb 11, 2008
  9. Jeff KingFeb 11, 2008
  10. Steffen ProhaskaFeb 11, 2008
  11. Jeff KingFeb 11, 2008

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.