git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Highlighting whitespace on removal with git diff
@ 2010-10-20  0:46 Stonky Fandango
  2010-10-20  3:15 ` Kevin Ballard
  0 siblings, 1 reply; 3+ messages in thread
From: Stonky Fandango @ 2010-10-20  0:46 UTC (permalink / raw)
  To: git

When I do say 'git diff', and I have added a line with a trailing
whitespace, i get a red square box highlighting the added whitespace.
(on the '+' diff line)
What I want, is the reverse - so when I delete an existing whitespace,
I get something similar, for example a blue box highlighting the
deleted whitespace (on the '-' diff line)

Currently the only notificate I get is identical
'-' and '+' diff lines, but no indication of the whitespace deleted

I know I can do this with graphical tools, but ideally would like some way
using the standard console git diff - if this is possible.

I have  the following in my .gitconfig
---
[color "diff"]
whitespace = red reverse
[core]
 whitespace=-indent-with-non-tab,trailing-space,cr-at-eol,tab-in-indent
---

Thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Highlighting whitespace on removal with git diff
  2010-10-20  0:46 Highlighting whitespace on removal with git diff Stonky Fandango
@ 2010-10-20  3:15 ` Kevin Ballard
  2010-10-20  6:10   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Ballard @ 2010-10-20  3:15 UTC (permalink / raw)
  To: Stonky Fandango; +Cc: git

The highlight isn't telling you what changed on the line. It's telling you that this added line has trailing whitespace, and your core.whitespace config value is set such that this is considered an error.

-Kevin Ballard

On Oct 19, 2010, at 5:46 PM, Stonky Fandango wrote:

> When I do say 'git diff', and I have added a line with a trailing
> whitespace, i get a red square box highlighting the added whitespace.
> (on the '+' diff line)
> What I want, is the reverse - so when I delete an existing whitespace,
> I get something similar, for example a blue box highlighting the
> deleted whitespace (on the '-' diff line)
> 
> Currently the only notificate I get is identical
> '-' and '+' diff lines, but no indication of the whitespace deleted
> 
> I know I can do this with graphical tools, but ideally would like some way
> using the standard console git diff - if this is possible.
> 
> I have  the following in my .gitconfig
> ---
> [color "diff"]
> whitespace = red reverse
> [core]
>  whitespace=-indent-with-non-tab,trailing-space,cr-at-eol,tab-in-indent
> ---
> 
> Thanks,
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Highlighting whitespace on removal with git diff
  2010-10-20  3:15 ` Kevin Ballard
@ 2010-10-20  6:10   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2010-10-20  6:10 UTC (permalink / raw)
  To: Kevin Ballard; +Cc: Stonky Fandango, git

Kevin Ballard <kevin@sb.org> writes:

> The highlight isn't telling you what changed on the line. It's telling
> you that this added line has trailing whitespace, and your
> core.whitespace config value is set such that this is considered an
> error.
>
> -Kevin Ballard

Which means that, in order to check for a whitespace error you removed in
your change, you can give "-R" (reverse) option to your "git diff".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-20  6:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20  0:46 Highlighting whitespace on removal with git diff Stonky Fandango
2010-10-20  3:15 ` Kevin Ballard
2010-10-20  6:10   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).