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

"git diff --ignore-space-change --stat" lists files with only whitespace differences as "changed"

From
Matt McCutchen <matt@mattmccutchen.net>
Date
Jan 18, 2017, 02:01 UTC
Message-ID
<1484704915.2096.16.camel@mattmccutchen.net>

A bug report: I noticed that "git diff --ignore-space-change --stat" lists files with only whitespace differences as having changed with 0 differing lines. This is inconsistent with the behavior without -- stat, which doesn't list such files at all. (Same behavior with all the --ignore*space* flags.) I can reproduce this with the current "next", af746e4. Quick test case:

echo ' ' >test1 && echo '  ' >test2 && git diff --stat --no-index --ignore-space-change test1 test2

This caused me some inconvenience in the following scenario: I was reading a commit diff that had a bulk license change in all files combined with code changes. I attempted to revert the bulk license change locally using "sed" to more easily read the code diff, but my reversion left some whitespace diffs where the original files had inconsistent whitespace. So the diffstat after my reversion was cluttered with these "0" entries.

Regards, Matt

Next: Jeff King
Message 1 of 5 in “"git diff --ignore-space-change --stat" lists files with only whitespace differences as "changed"”
  1. Matt McCutchenJan 18, 2017
  2. Jeff KingJan 18, 2017
  3. Junio C HamanoJan 18, 2017
  4. Jeff KingJan 18, 2017
  5. Junio C HamanoJan 18, 2017

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.