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

Re: Mark trailing whitespace error in del lines of diff

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
May 25, 2015, 22:22 UTC
Message-ID
<20150525222215.GI26436@vauxhall.crustytoothpaste.net>
In-Reply-To
<9b8e349e223dc9cd871fc5f7915e590548322932.1432585659.git.cb@256bit.org>
On Mon, May 25, 2015 at 11:11:34PM +0200, Christian Brabandt wrote:
Show 7 quoted lines
> Here is my use case: I have been working in a team repository,
> reformatting the source and wondered, why my reformatting did introduce
> some trailing whitespace. I suspected a bug in Vim and started to debug
> it, until I found out, that git-diff simply does not show trailing
> whitespace in the deleted lines. Therefore, I'd like to have an option,
> to also show trailing whitespace in the deleted lines of a diff. So here
> is the patch.

I like this idea. My use case is determining whether a patch to a pristine-tar repository introduced trailing whitespace (which is not okay) or just left it there (which is okay).

> As far as I can see, this does not break any tests and also the
> behaviour of git-diff --check does not change.

Perhaps you'd care to implement a test or two to make sure that this continues to work properly?

Show 15 quoted lines
>  Documentation/config.txt | 2 ++
>  cache.h                  | 1 +
>  diff.c                   | 8 +++++++-
>  ws.c                     | 8 ++++++--
>  4 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 0f668bb..f73f0f7 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -670,6 +670,8 @@ core.whitespace::
>  +
>  * `blank-at-eol` treats trailing whitespaces at the end of the line
>    as an error (enabled by default).
> +* `blank-at-eol-old` like `blank-at-eol`, but for the deleted lines

You might want to insert "works" before "like" so that it's a complete sentence.

> +  of a patch (i.e. those preceeded with a '-') (not enabled by default)
I believe this should be "preceded".
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Previous: Christian BrabandtNext: Junio C Hamano
Message 2 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.