Re: [RFD] Strange patch formats (aka tricks with unified diffs)..
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Apr 13, 2007, 15:00 UTC
- Message-ID
- <Pine.LNX.4.64.0704130751560.28042@woody.linux-foundation.org>
- In-Reply-To
- <20070413081049.GA26649@moooo.ath.cx>
On Fri, 13 Apr 2007, Matthias Lederhofer wrote:
Show 8 quoted lines
> Linus Torvalds <torvalds@linux-foundation.org> wrote: > > - add some actual switch to git diff generation to hide the negative side > > of a unified diff, and add some way to just make gitk pass that switch > > in. > > This one would still allow to show the added lines still colored in > green. Or do I miss a way to do this? git show --color is not very > grep friendly because lines begin with an escape sequence.
Heh. I'm not much for color, so I've never done it. But if you want it, you should be able to just do
git show --color <commit> | grep -v '^[^ ]*-' | less -RS
because every line of a diff (and even the explanations, thanks to the indent-by-four rule of git log printing) should either start with a "+/-" *or* they will have a space before they will show up, so using the "no spaces before the -" rule instead of "beginning of line" should work..
So the above will *literally* just remove the "---" line and the actual removal lines of the diff, even in the presense of color coding.
The exception, of course, is: - maybe I didn't think it through and I missed some case, and it removes lines it shouldn't. - if you make the color coding itself have spaces or something in it you break my assumption (but the vt100 codes should be fine)
Hmm?
Linus