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

[PATCH 0/2] Update "diff -w --exit-code"

From
Junio C Hamano <gitster@pobox.com>
Date
May 23, 2009, 19:24 UTC
Message-ID
<1243106690-6385-1-git-send-email-gitster@pobox.com>

Here is a re-roll of the earlier patch to change the exit status of "diff" family of commands on whitespace only changes.

Earlier, "-w" and friends only affected the displayed of textual diff output and never caused the commands to ignore the presense of differences. With this, the commands exit with zero status when the changes are only about whitespaces that you are ignoring.

E.g. starting from a clean slate:
	$ echo ' a' >a-file ;# one space
	$ git add a-file
	$ echo '  a' >a-file ;# two spaces
	$ git diff --exit-code -w >/dev/null; echo $?
will give 0, instead of 1.

The fact that you have changes (i.e. the contents of a-file as a whole has changed) is still reported in the textual part of the output by showing the "diff --git a/a-file b/b-file" header and the "index objname..objname mode" line. This is not likely to change.

Junio C Hamano (2):
  diff: change semantics of "ignore whitespace" options
  diff: Rename QUIET internal option to QUICK
 builtin-log.c                |    2 +-
 builtin-rev-list.c           |    2 +-
 diff-lib.c                   |    4 +-
 diff.c                       |   39 ++++++++++++++++++++++---
 diff.h                       |    3 +-
 revision.c                   |    2 +-
 t/t4037-whitespace-status.sh |   63 ++++++++++++++++++++++++++++++++++++++++++
 tree-diff.c                  |    3 +-
 8 files changed, 106 insertions(+), 12 deletions(-)
 create mode 100755 t/t4037-whitespace-status.sh
Next: Junio C Hamano
Message 1 of 5 in “Update "diff -w --exit-code"”
  1. 0/2 Update "diff -w --exit-code"Junio C Hamano, May 23, 2009
  2. 1/2 diff: change semantics of "ignore whitespace" optionsJunio C Hamano, May 23, 2009
  3. 2/2 diff: Rename QUIET internal option to QUICKJunio C Hamano, May 23, 2009
  4. Jeff KingMay 25, 2009
  5. Junio C HamanoMay 25, 2009

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.