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

Re: [PATCH 1/2] git-commit: Disallow unchanged tree in non-merge mode

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Sep 14, 2007, 17:14 UTC
Message-ID
<alpine.LFD.0.999.0709141002360.16478@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.0.999.0709132123570.16478@woody.linux-foundation.org>
On Thu, 13 Sep 2007, Linus Torvalds wrote:
> 
> Ok, I'm downloading those tar-balls to reproduce and hopefully see what's 
> going on, but I'm not going to be able to get at it today.

Ok, I'm seeing it, and there are serious problems in the diffcore-rename code.

The problems include things like actual overflow in 31 bits (a signed integer) from the multiplication of "num_create * num_src".

But you'll almost certainly never even get there, because you'd long since have given up on the O(n^2) behaviour of the "cheap tests", that aren't really cheap enough, if only because even just comparing the 20-byte SHA1 hashes will basically take forever since they will always miss in the cache for lots of names.

So yes, we really *have* to have a rename limit, even if it's only to avoid the technical bug of overflowing the multiplication.

Testing this actually showed another bug too: "git diff" would actually never call "diff_setup_done() at all, if "diffopt.output_format" had been set explicitly to something. So doing a "git diff --stat" would totally ignore all the sanity checks (and, what caused me to find it, the initialization of "diffopt.rename_limit") that diff_setup_done() is supposed to do!

So I'm going to send out two patches - one to fix the "diff_setup_done()" bug, and one that replaces the default rename_limit with something saner. Both seem to be real bugs.

			Linus
Previous: Dmitry V. LevinNext: Linus Torvalds
Message 4 of 13 in “git-commit: Disallow unchanged tree in non-merge mode”
  1. 1/2 git-commit: Disallow unchanged tree in non-merge modeDmitry V. Levin, Sep 5, 2007
  2. Shawn O. PearceSep 6, 2007
  3. Dmitry V. LevinSep 6, 2007
  4. Linus TorvaldsSep 14, 2007
  5. 1/2 Fix "git diff" setup codeLinus Torvalds, Sep 14, 2007
  6. 2/2 Fix the rename detection limit checkingLinus Torvalds, Sep 14, 2007
  7. Linus TorvaldsSep 14, 2007
  8. Linus TorvaldsSep 14, 2007
  9. Junio C HamanoSep 14, 2007
  10. Linus TorvaldsSep 14, 2007
  11. Junio C HamanoSep 14, 2007
  12. Linus TorvaldsSep 14, 2007
  13. Junio C HamanoSep 14, 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.