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

Re: git diff-files weirdness (bug?)

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
May 23, 2008, 16:14 UTC
Message-ID
<alpine.LFD.1.10.0805230906110.3081@woody.linux-foundation.org>
In-Reply-To
<b0943d9e0805230720h61cbabbbw180908e1b28a34cc@mail.gmail.com>
Looks like a real bug.
On Fri, 23 May 2008, Catalin Marinas wrote:
Show 19 quoted lines
>
> I was investigating a bug in "stg refresh" failing with moved files
> and noticed that it was caused by Git (HEAD pulled yesterday):
> 
>   git init
>   touch a
>   git add a
>   git commit -m "test"
>   git mv a b
> 
> These are OK:
> 
>   git diff-files -- a
>   git diff-files -- b
> 
> These fail:
> 
>   git diff-files -- a b
>   git diff-files -- a c
Yes, that's buggy.

What happens is that we get to run_diff_files_cmd(), but then we don't actually do "run_diff_files()", because we go into the NO_INDEX case:

	if (DIFF_OPT_TST(&revs->diffopt, NO_INDEX)) {
		...
instead.
Which in turn is because "setup_diff_no_index()" is broken.

And I think "setup_diff_no_index()" is broken exactly because it sees that '--' and then totally ignores it and says "if I see two paths, we'll say it's the non-index case".

		Linus
Previous: Catalin MarinasNext: Linus Torvalds
Message 2 of 11 in “git diff-files weirdness (bug?)”
  1. Catalin MarinasMay 23, 2008
  2. Linus TorvaldsMay 23, 2008
  3. Linus TorvaldsMay 23, 2008
  4. diff -- file1 file2: do not default to --no-index inside a git repositoryJohannes Schindelin, May 23, 2008
  5. diff file1 file2: do not default to --no-index inside a git repositoryJohannes Schindelin, May 23, 2008
  6. Junio C HamanoMay 24, 2008
  7. 1/3 tests: do not use implicit "git diff --no-index"Junio C Hamano, May 24, 2008
  8. 2/3 diff-files: do not play --no-index gamesJunio C Hamano, May 24, 2008
  9. 3/3 "git diff": do not ignore index without --no-indexJunio C Hamano, May 24, 2008
  10. Junio C HamanoMay 24, 2008
  11. Junio C HamanoMay 24, 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.