Skip to content

Update "diff -w --exit-code"

Junio C Hamano git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2diff: change semantics of "ignore whitespace" optionsdiff.c diff.h t/t4037-whitespace-status.sh +1 more+98 -42 replies
2/2diff: Rename QUIET internal option to QUICKbuiltin-log.c builtin-rev-list.c diff-lib.c +4 more+9 -90 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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