Skip to content

"diff --check" and whitespace enhancements

Wincent Colaiuta git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5"diff --check" should affect exit statusDocumentation/diff-options.txt builtin-diff-files.c builtin-diff-index.c +5 more+184 -3010 replies
2/5New version of pre-commit hooktemplates/hooks--pre-commit+7 -603 replies
3/5Unify whitespace checkingbuiltin-apply.c cache.h diff.c +2 more+139 -1643 replies
4/5Make "diff --check" output match "git apply"builtin-apply.c diff.c+3 -41 reply
5/5Add tests for "git diff --check" with core.whitespace optionst/t4015-diff-whitespace.sh+50 -01 reply

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/5] "diff --check" and whitespace enhancements

This is a repost of the topic I posted yesterday, rebased on top of master and omitting the changes already applied to it.

Of the series the most interesting is [3/5], where I implement Junio's suggestion of further refactoring to get rid of emit_line_with_ws().

[1/5] "diff --check" should affect exit status
[2/5] New version of pre-commit hook
[3/5] Unify whitespace checking
[4/5] Make "diff --check" output match "git apply"
[5/5] Add tests for "git diff --check" with core.whitespace options

I think there are still some opportunities for further refactoring and clean-up, but this is a good start.

Overall the refactoring saves duplication and reduces the line count (apart from the tests, of course, where line count goes unequivocally up).

 Documentation/diff-options.txt |    4 +-
 builtin-apply.c                |   56 +++----------
 builtin-diff-files.c           |    2 +
 builtin-diff-index.c           |    2 +
 builtin-diff-tree.c            |   28 +++---
 builtin-diff.c                 |    3 +-
 cache.h                        |    4 +
 diff.c                         |  172 +++++++++---------------------------
 diff.h                         |    1 +
 t/t4015-diff-whitespace.sh     |  189 +++++++++++++++++++++++++++++++++++++++-
 templates/hooks--pre-commit    |   67 ++-------------
 ws.c                           |  105 ++++++++++++++++++++++
 12 files changed, 379 insertions(+), 254 deletions(-)

Cheers,
Wincent