Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Git Mailing List <git@vger.kernel.org>,
	Paul Mackerras <paulus@samba.org>
Subject: Re: [RFD] Strange patch formats (aka tricks with unified diffs)..
Date: Thu, 12 Apr 2007 16:02:56 -0700	[thread overview]
Message-ID: <7vodlti4bj.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0704121436050.4061@woody.linux-foundation.org> (Linus Torvalds's message of "Thu, 12 Apr 2007 14:58:28 -0700 (PDT)")

Linus Torvalds <torvalds@linux-foundation.org> writes:

> I'm normally actually very good at doing that "grep" mentally, and don't 
> actually often need to do it explicitly at all, unless the patch is just 
> pretty messy. But sometimes the patch is just confusing enough that it 
> helps to explicitly filter it.
>
> Now, the reason I mention this is that I was just in "gitk", and while I 
> love the gitk graphical revision view, I just noticed (once again) why I 
> tend to hate most GUI programs. I can't do the clever tricks! The gitk 
> diffs are nice and colorized, but the "show just end result" trick just 
> doesn't work.

> So I can see two ways to fix this:
>  - bug Paul about alternate diff viewing capabilities in gitk. He's cc'd 
>    here. A way to make the "diff" pane show just the new one, the old one, 
>    or even both side-by-side with some mousy interface?
>  - 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.

The switch itself would literally be a one-liner (see below).

However, I suspect what you want is _not_ "turn the negative
side completely off", but "make the negative side visually more
easily ignorable".

How about displaying the deleted lines with light gray on white
background, or something like that?

> I dunno. I realize that it's not just gitk - gitweb, qgit etc don't allow 
> the tricks *either*, but gitk was the one I just hit this with. I ended up 
> just cutting-and-pasting the SHA1 and doing the thing in a terminal with 
> the shell pipeline instead. Am wondering if maybe other people have ideas 
> on this.

diff --git a/diff.c b/diff.c
index fbb79d7..e61abed 100644
--- a/diff.c
+++ b/diff.c
@@ -565,6 +565,8 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
 	}
 
 	if (color != DIFF_FILE_NEW) {
+		if (diff_no_deleted_lines && color == DIFF_FILE_OLD)
+			return;
 		emit_line(diff_get_color(ecbdata->color_diff, color),
 			  reset, line, len);
 		return;

  reply	other threads:[~2007-04-12 23:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-12 21:58 [RFD] Strange patch formats (aka tricks with unified diffs) Linus Torvalds
2007-04-12 23:02 ` Junio C Hamano [this message]
2007-04-13  5:38 ` Marco Costalba
2007-04-17 18:02   ` Marco Costalba
2007-04-13  5:43 ` Paul Mackerras
2007-04-13  6:07   ` Martin Langhoff
2007-04-13  6:35     ` Junio C Hamano
2007-04-13  7:01       ` Martin Langhoff
2007-04-14  8:59       ` Johannes Schindelin
2007-04-14  9:55         ` Junio C Hamano
2007-04-14 10:09           ` Jeff King
2007-04-13 15:16   ` Linus Torvalds
2007-04-18  1:44     ` Paul Mackerras
2007-04-18  4:02       ` Linus Torvalds
2007-04-13  8:10 ` Matthias Lederhofer
2007-04-13 15:00   ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vodlti4bj.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox