Junio C Hamano <gitster@xxxxxxxxx> writes: > The plumbing that looks at the working tree, i.e. "diff-index" and > "diff-files", always emit the "diff --git a/path b/path" header lines > without anything else for paths that are only stat-dirty (i.e. different > only because the cached stat information in the index no longer matches > that of the working tree, but the real contents are the same), when > these commands are run with "-p" option to produce patches. > > Illustrate this current behaviour. The new part that uses "-w" option > demonstrates that we do not show any "diff --git" header for blobs whose > true contents are different but compares the same when whitespaces are > ignored, which is inconsistent with the behaviour for stat-dirty paths. [...] > -test_expect_success SYMLINKS 'diff identical, but newly created symlink' ' > +test_expect_success SYMLINKS 'diff identical, but newly created symlink and file' ' > cat >expected <<-\EOF && > diff --git a/frotz b/frotz > + diff --git a/nitfol b/nitfol > EOF > + sleep 3 && > + rm -f frotz && > + echo xyzzy >nitfol3 && > + mv nitfol3 nitfol && > ln -s xyzzy frotz && > git diff-index -M -p $tree >current && > + compare_diff_patch expected current && > + > + >expected && > + git diff-index -M -p -w $tree >current && > compare_diff_patch expected current > ' I find the last bit of the commit message rather confusing. You appear to be using -w here to diff the stat-dirty worktree nitfol 'xyzzy\n' against the $tree:nitfol which is also 'xyzzy\n'. 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. 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; * 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. -- Thomas Rast trast@{inf,student}.ethz.ch -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html