Skip to content

showing existing ws breakage

Junio C Hamano git 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 7 repliesIn review
  2. v24 patches 0 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4t4015: modernise stylet/t4015-diff-whitespace.sh+173 -2380 replies
2/4t4015: separate common setup and per-test expectationt/t4015-diff-whitespace.sh+13 -120 replies
3/4diff.c: add emit_del_line() and emit_context_line()diff.c+38 -120 replies
4/4diff.c: --ws-error-highlight=<kind> optionDocumentation/diff-options.txt diff.c diff.h +1 more+179 -160 replies

Reviews trailers per patch

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

Read the v3 thread

Cover letter [PATCH v3 0/4] showing existing ws breakage

We paint whitespace breakages in new (i.e. added or updated) lines when showing the "git diff" output to help people avoid introducing them with their changes. The basic premise is that people would want to avoid touching existing lines only to fix whitespace errors in a patch that does other changes of substance, and that is why we traditionally did not paint whitespace breakages in existing (i.e. deleted or context) lines.

However, some people would want to keep existing breakages when they are doing other changes of substance; "new" lines in such a patch would show existing whitespace breakages painted, and it is not apparent if the breakages were inherited from the original or newly introduced.

Christian Brabandt had an interesting idea to help users in this situation; why not give them a mode to paint whitespace breakages in "old" (i.e. deleted or was replaced) lines, too?

http://thread.gmane.org/gmane.comp.version-control.git/269912/focus=269956

This series is a reroll of the previous one

http://thread.gmane.org/gmane.comp.version-control.git/269972

which built on Christian'sidea, but with a different implementation (Christian's original painted trailing whitespaces only).

The first two patches are unchanged since v2; they are preliminary clean-ups.

The third one extends the corresponding patch since v2; not only a helper for "deleted" lines but also another helper for "context" lines is added.

The fourth one in v2 used a new option "--[no-]ws-check-deleted", but in this round a new option "--ws-error-highlight=<kinds>" is defined instead. With that, you can say

	diff --ws-error-highlight=new,old

to say "I want to see whitespace errors on new and old lines", and

	diff --ws-error-highlight=new,old,context
	diff --ws-error-highlight=all

can be used to also see whitespace errors on context lines. Being able to see whitespace errors on context lines, i.e. the ones that were there in the original and you left intact, would help you see how prevalent whitespace errors are in the original and hopefully would make it easier for you to decide if a separate preliminary clean-up to only fix these whitespace errors is warranted.

Junio C Hamano (4):
t4015: modernise style
t4015: separate common setup and per-test expectation diff.c: add emit_del_line() and emit_context_line() diff.c: --ws-error-highlight=<kind> option

 Documentation/diff-options.txt |  10 +
 diff.c                         | 122 ++++++++--
 diff.h                         |   5 +
 t/t4015-diff-whitespace.sh     | 508 ++++++++++++++++++++++-------------------
 4 files changed, 385 insertions(+), 260 deletions(-)
Signature · 1 line
2.4.2-503-g3e4528a