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

[PATCH v2 0/5] showing existing ws breakage

From
Junio C Hamano <gitster@pobox.com>
Date
May 26, 2015, 19:46 UTC
Message-ID
<1432669584-342-1-git-send-email-gitster@pobox.com>
In-Reply-To
<xmqq1ti3kz5v.fsf@gitster.dls.corp.google.com>

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 builds on that idea but with a different implementation (Christian's original painted trailing whitespaces only).

The first three patches are preliminary cleanups. The last one is the interesting bit.

Having done this series, I am starting to suspect that painting ws breakages only in deleted lines may not be such a useful thing to do. In order to decide if fixing ws breakages "while at it" is more appropriate, you would need to know if such breakages are prevalent in the original. After all, the line you are updating might be one of only few lines that the original had breakages, in which case you may want to go back to your editor and fix them all while you are at it, or fix only these few ws breakages as a preliminary step. In order to help users do that, the new option may be better not to limit itself to "deleted" lines, but "context and deleted", i.e. "preimage" lines.

Junio C Hamano (4):
  t4015: modernise style
  t4015: separate common setup and per-test expectation
  diff.c: add emit_del_line() and update callers of emit_line_0()
  diff.c: --ws-check-deleted option
 Documentation/diff-options.txt |   7 +
 diff.c                         |  58 +++--
 diff.h                         |   1 +
 t/t4015-diff-whitespace.sh     | 474 ++++++++++++++++++++---------------------
 4 files changed, 290 insertions(+), 250 deletions(-)
-- 
2.4.1-511-gc1146d5
Previous: Christian BrabandtNext: Junio C Hamano
Message 11 of 30 in “Mark trailing whitespace error in del lines of diff”
  1. Christian BrabandtMay 25, 2015
  2. brian m. carlsonMay 25, 2015
  3. Junio C HamanoMay 25, 2015
  4. brian m. carlsonMay 25, 2015
  5. Christian BrabandtMay 26, 2015
  6. Junio C HamanoMay 26, 2015
  7. Junio C HamanoMay 26, 2015
  8. Christian BrabandtMay 26, 2015
  9. Junio C HamanoMay 26, 2015
  10. Christian BrabandtMay 26, 2015
  11. 0/5 showing existing ws breakageJunio C Hamano, May 26, 2015
  12. 1/4 t4015: modernise styleJunio C Hamano, May 26, 2015
  13. 2/4 t4015: separate common setup and per-test expectationJunio C Hamano, May 26, 2015
  14. 3/4 diff.c: add emit_del_line() and update callers of emit_line_0()Junio C Hamano, May 26, 2015
  15. 4/4 diff.c: --ws-check-deleted optionJunio C Hamano, May 26, 2015
  16. 0/4 showing existing ws breakageJunio C Hamano, May 27, 2015
  17. 1/4 t4015: modernise styleJunio C Hamano, May 27, 2015
  18. 2/4 t4015: separate common setup and per-test expectationJunio C Hamano, May 27, 2015
  19. 3/4 diff.c: add emit_del_line() and emit_context_line()Junio C Hamano, May 27, 2015
  20. 4/4 diff.c: --ws-error-highlight=<kind> optionJunio C Hamano, May 27, 2015
  21. Jeff KingMay 27, 2015
  22. Junio C HamanoMay 27, 2015
  23. Jeff KingMay 27, 2015
  24. Junio C HamanoMay 27, 2015
  25. Jeff KingMay 27, 2015
  26. Junio C HamanoMay 27, 2015
  27. Jeff KingMay 27, 2015
  28. Junio C HamanoMay 26, 2015
  29. Christian BrabandtMay 26, 2015
  30. Junio C HamanoMay 26, 2015

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.