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