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

Re: [PATCH 2/4] t4011: illustrate "diff-index -p" on stat-dirty paths

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 1, 2012, 16:18 UTC
Message-ID
<7vzkc0nvlk.fsf@alter.siamese.dyndns.org>
In-Reply-To
<87399slmh4.fsf@thomas.inf.ethz.ch>
Thomas Rast <trast@inf.ethz.ch> writes:
Show 6 quoted lines
> If that analysis is correct, then
>
>   we do not show any "diff --git" header for blobs whose true contents
>   are different but compares the same when whitespaces are ignored
>
> is not what is going on here; the blobs have exactly the same content.

True; an earlier draft actually had an 'echo " xyzzy" >nitfol' in there, but it meant that it needed another annoying 'sleep 3' (I could have used test-chmtime), so the test was updated but the above description stayed.

> The difference is that
>
> * without -w, the code "knows" from the lstat() data that the files are
>   different, prints a header, and then fails to find any differences;
Correct. Those quotes around "knows" are the most important ;-)

The code incorrectly thinks the stat dirtyness is all that it "knows"; even though it has a way to act on a better knowledge from the xdiff these days, it does not utilize it.

Show 9 quoted lines
> * with -w, the code correctly holds off on printing anything since it
>   will invariably have to inspect the contents beforehand.
>
> So perhaps you can say
>
>   Illustrate this current behaviour.  Also demonstrate that with the
>   "-w" option, we (correctly) hold off showing a "diff --git" header
>   until actual differences have been found.  This also suppresses the
>   header for merely stat-dirty files, which is inconsistent.
That is much better; thanks.
Previous: Thomas RastNext: Junio C Hamano
Message 5 of 10 in “"diff -p" patch header generation updates”
  1. 0/4 "diff -p" patch header generation updatesJunio C Hamano, Mar 1, 2012
  2. 1/4 t4011: modernise styleJunio C Hamano, Mar 1, 2012
  3. 2/4 t4011: illustrate "diff-index -p" on stat-dirty pathsJunio C Hamano, Mar 1, 2012
  4. Thomas RastMar 1, 2012
  5. Junio C HamanoMar 1, 2012
  6. 2/4 t4011: illustrate "diff-index -p" on stat-dirty pathsJunio C Hamano, Mar 1, 2012
  7. Zbigniew Jędrzejewski-SzmekMar 1, 2012
  8. Junio C HamanoMar 1, 2012
  9. 3/4 diff -p: squelch "diff --git" header for stat-dirty pathsJunio C Hamano, Mar 1, 2012
  10. 4/4 diff --ignore-mode-changeJunio C Hamano, Mar 1, 2012

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.