git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [wishlist] graphical diff
@ 2007-03-18 13:16 Raimund Bauer
  2007-03-18 15:06 ` Robin Rosenberg
  2007-03-18 21:39 ` Christian MICHON
  0 siblings, 2 replies; 11+ messages in thread
From: Raimund Bauer @ 2007-03-18 13:16 UTC (permalink / raw)
  To: git

I think it would be really helpful (especially for newbies like me) to
have an option like

git diff --gui [revisions] <singe path spec>

to fire up a graphical diff viewer (similar to what git-mergetool does).

Another good place to start a graphical diff from is probably gitk from
a context-menu for the changed files in the lower right pane.

Thoughts?

-- 
best regards

  Ray

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

* Re: [wishlist] graphical diff
  2007-03-18 13:16 [wishlist] graphical diff Raimund Bauer
@ 2007-03-18 15:06 ` Robin Rosenberg
  2007-03-18 23:09   ` Johannes Schindelin
  2007-03-18 21:39 ` Christian MICHON
  1 sibling, 1 reply; 11+ messages in thread
From: Robin Rosenberg @ 2007-03-18 15:06 UTC (permalink / raw)
  To: Raimund Bauer; +Cc: git

söndag 18 mars 2007 14:16 skrev Raimund Bauer:
> I think it would be really helpful (especially for newbies like me) to
> have an option like
> 
> git diff --gui [revisions] <singe path spec>
> 
> to fire up a graphical diff viewer (similar to what git-mergetool does).
> 
> Another good place to start a graphical diff from is probably gitk from
> a context-menu for the changed files in the lower right pane.
> 
> Thoughts?
> 

Fine, except it is not likely to be my favourite gui. But you don't have to wait,
you can get a gui easily today.

Pipe the output to another tool. Kompare is such a tool which can take a patch
and compare it. It does not have to a single file. You can diff  two trees and
compare. You'll need at kdesdk version 3.5.5 (or 3.5.6)  or the patch in
http://bugs.kde.org/show_bug.cgi?id=131717 for kompare to display git diffs.

git diff HEAD^..HEAD | kompare -

As for other gui's I don't know which ones work easily out of the box. 

Eclipse will soon have recursive diff mode for git. Seems to work here, so I'll probably submit it soon). 

-- robin

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

* Re: [wishlist] graphical diff
  2007-03-18 13:16 [wishlist] graphical diff Raimund Bauer
  2007-03-18 15:06 ` Robin Rosenberg
@ 2007-03-18 21:39 ` Christian MICHON
  1 sibling, 0 replies; 11+ messages in thread
From: Christian MICHON @ 2007-03-18 21:39 UTC (permalink / raw)
  To: Raimund Bauer; +Cc: git

On 3/18/07, Raimund Bauer <ray007@gmx.net> wrote:
> I think it would be really helpful (especially for newbies like me) to
> have an option like
>
> git diff --gui [revisions] <singe path spec>
>
> to fire up a graphical diff viewer (similar to what git-mergetool does).
>
> Another good place to start a graphical diff from is probably gitk from
> a context-menu for the changed files in the lower right pane.
>
> Thoughts?
>

gvimdiff is pretty cool. Have a look at the archives, I asked
recently how to perform this, and a few solutions came out
(you need a sane shell, and the abilities to create fifos).

I'd use it everyday if a true vim/gvim explorer plugin would
exist (and it's hard to code!).

-- 
Christian

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

* Re: [wishlist] graphical diff
  2007-03-18 15:06 ` Robin Rosenberg
@ 2007-03-18 23:09   ` Johannes Schindelin
  2007-03-18 23:51     ` Robin Rosenberg
  2007-03-19  8:14     ` Raimund Bauer
  0 siblings, 2 replies; 11+ messages in thread
From: Johannes Schindelin @ 2007-03-18 23:09 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: Raimund Bauer, git

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3197 bytes --]

Hi,

On Sun, 18 Mar 2007, Robin Rosenberg wrote:

> söndag 18 mars 2007 14:16 skrev Raimund Bauer:
> > I think it would be really helpful (especially for newbies like me) to
> > have an option like
> > 
> > git diff --gui [revisions] <singe path spec>

And how do you set _what_ gui you want? Everybody has her pet diff-viewer 
(mine is less, BTW).

> Fine, except it is not likely to be my favourite gui. But you don't have 
> to wait, you can get a gui easily today.
>
> [...] 
> 
> git diff HEAD^..HEAD | kompare -

BTW here, "kompare -" does not work as expected. It shows an empty diff. 
At any rate, have you tried something like "GIT_PAGER='kompare -' git diff 
HEAD^..HEAD"?

This reminds me that I always wanted to be able to set the pager from the 
command line, so I can set an alias easily:

-- snipsnap --
[PATCH] Allow setting the pager from the command line

The command `git` already allows piping the output into a pager with
`-p`. Now also allow to set the pager with `-p=<pager-cmd>`.

With this, it is possible to make an alias of command/pager combos, like
this:

	$ git config alias.showmore '-p=more show'

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Documentation/git.txt |    8 +++++---
 git.c                 |    7 ++++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Documentation/git.txt b/Documentation/git.txt
index 0b1203e..5634b30 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -9,7 +9,7 @@ git - the stupid content tracker
 SYNOPSIS
 --------
 [verse]
-'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate]
+'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate][=<pager-cmd>]
 	[-n|--name-rev] [-t|--name-rev-by-tags] [--bare]
 	[--git-dir=GIT_DIR] [--help] COMMAND [ARGS]
 
@@ -75,8 +75,10 @@ OPTIONS
 	environment variable. If no path is given 'git' will print
 	the current setting and then exit.
 
--p|--paginate::
-	Pipe all output into 'less' (or if set, $PAGER).
+-p|--paginate[=<pager-cmd>]::
+	Pipe all output into 'less'. You can override this by
+	"=<pager-cmd>", or setting the environment variables $GIT_PAGER
+	or $PAGER (in that order).
 
 -n|--name-rev:
 	Try naming all SHA1s, and page the result (see
diff --git a/git.c b/git.c
index fca1dfb..76b126d 100644
--- a/git.c
+++ b/git.c
@@ -4,7 +4,7 @@
 #include "quote.h"
 
 const char git_usage_string[] =
-	"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] [--bare] [--git-dir=GIT_DIR] [--help] COMMAND [ARGS]";
+	"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate][=pager_cmd] [--bare] [--git-dir=GIT_DIR] [--help] COMMAND [ARGS]";
 
 static void prepend_to_path(const char *dir, int len)
 {
@@ -58,6 +58,11 @@ static int handle_options(const char*** argv, int* argc)
 			}
 		} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
 			setup_pager();
+		} else if (!prefixcmp(cmd, "-p=") ||
+				!prefixcmp(cmd, "--paginate=")) {
+			const char *equal = strchr(cmd, '=');
+			setenv("GIT_PAGER", equal + 1, 1);
+			setup_pager();
 		} else if (!strcmp(cmd, "-n") || !strcmp(cmd, "--name-rev"))
 			setup_name_rev_pager(0);
 		else if (!strcmp(cmd, "-t") ||
-- 
1.5.0.4.2713.g4ff1

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

* Re: [wishlist] graphical diff
  2007-03-18 23:09   ` Johannes Schindelin
@ 2007-03-18 23:51     ` Robin Rosenberg
  2007-03-19  0:09       ` Johannes Schindelin
  2007-03-19  8:14     ` Raimund Bauer
  1 sibling, 1 reply; 11+ messages in thread
From: Robin Rosenberg @ 2007-03-18 23:51 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Raimund Bauer, git

måndag 19 mars 2007 00:09 skrev Johannes Schindelin:
> On Sun, 18 Mar 2007, Robin Rosenberg wrote:
> > git diff HEAD^..HEAD | kompare -
> 
> BTW here, "kompare -" does not work as expected. It shows an empty diff. 
I think that's what the older kompare did. That why mentioned that you need the
verson from 3.5.5, or even 3.5.6 for this to work.

> At any rate, have you tried something like "GIT_PAGER='kompare -' git diff 
> HEAD^..HEAD"?
Doesn't work here. Shows empty diff...

but AH, that's because of the colored-diff settings. I you have color.diff or color.status
set to true neither version will work. With auto the first one will, but not the second. 

-- robin

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

* Re: [wishlist] graphical diff
  2007-03-18 23:51     ` Robin Rosenberg
@ 2007-03-19  0:09       ` Johannes Schindelin
  0 siblings, 0 replies; 11+ messages in thread
From: Johannes Schindelin @ 2007-03-19  0:09 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: Raimund Bauer, git

[-- Attachment #1: Type: TEXT/PLAIN, Size: 727 bytes --]

Hi,

On Mon, 19 Mar 2007, Robin Rosenberg wrote:

> måndag 19 mars 2007 00:09 skrev Johannes Schindelin:
> 
> > At any rate, have you tried something like "GIT_PAGER='kompare -' git 
> > diff HEAD^..HEAD"?
>
> Doesn't work here. Shows empty diff...
> 
> but AH, that's because of the colored-diff settings. I you have 
> color.diff or color.status set to true neither version will work.

I wonder why we still have "color.diff=true", which is wrong in almost 
_all_ cases (instead it should be auto).

> With auto the first one will, but not the second.

That is to be expected... Git actually expects the pager to be just that, 
a pager. So you have to say

$ GIT_PAGER='kompare -' git diff --no-color HEAD^..HEAD

Hth,
Dscho

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

* RE: [wishlist] graphical diff
  2007-03-18 23:09   ` Johannes Schindelin
  2007-03-18 23:51     ` Robin Rosenberg
@ 2007-03-19  8:14     ` Raimund Bauer
  2007-03-19 13:00       ` Johannes Schindelin
  1 sibling, 1 reply; 11+ messages in thread
From: Raimund Bauer @ 2007-03-19  8:14 UTC (permalink / raw)
  To: 'Johannes Schindelin', 'Robin Rosenberg'; +Cc: 'git'

On Monday, March 19, Johannes Schindelin wrote:
> > söndag 18 mars 2007 14:16 skrev Raimund Bauer:
> > > I think it would be really helpful (especially for 
> newbies like me) 
> > > to have an option like
> > > 
> > > git diff --gui [revisions] <singe path spec>
> 
> And how do you set _what_ gui you want? Everybody has her pet 
> diff-viewer 
> (mine is less, BTW).

Maybe with a git.gui config option (like merge.tool)?
Or by specifying on the commandline:

git diff --gui=<my-gui-differ> ...

And <my-gui-differ> = xxdiff | kompare | tkdiff | ...

-- 
best regards

  Ray

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

* RE: [wishlist] graphical diff
  2007-03-19  8:14     ` Raimund Bauer
@ 2007-03-19 13:00       ` Johannes Schindelin
  2007-03-19 16:44         ` Raimund Bauer
  0 siblings, 1 reply; 11+ messages in thread
From: Johannes Schindelin @ 2007-03-19 13:00 UTC (permalink / raw)
  To: Raimund Bauer; +Cc: 'Robin Rosenberg', 'git'

[-- Attachment #1: Type: TEXT/PLAIN, Size: 799 bytes --]

Hi,

On Mon, 19 Mar 2007, Raimund Bauer wrote:

> On Monday, March 19, Johannes Schindelin wrote:
> > > söndag 18 mars 2007 14:16 skrev Raimund Bauer:
> > > > I think it would be really helpful (especially for 
> > newbies like me) 
> > > > to have an option like
> > > > 
> > > > git diff --gui [revisions] <singe path spec>
> > 
> > And how do you set _what_ gui you want? Everybody has her pet 
> > diff-viewer 
> > (mine is less, BTW).
> 
> Maybe with a git.gui config option (like merge.tool)?
> Or by specifying on the commandline:
> 
> git diff --gui=<my-gui-differ> ...
> 
> And <my-gui-differ> = xxdiff | kompare | tkdiff | ...

Have you actually looked at the patch I sent? It is more logical to say 
"git -p=<bla> diff ..." when the option "-p" (without "=") already exists.

Ciao,
Dscho

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

* RE: [wishlist] graphical diff
  2007-03-19 13:00       ` Johannes Schindelin
@ 2007-03-19 16:44         ` Raimund Bauer
  2007-03-19 16:49           ` Johannes Schindelin
  0 siblings, 1 reply; 11+ messages in thread
From: Raimund Bauer @ 2007-03-19 16:44 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: 'Robin Rosenberg', 'git'

Hi,

On Mon, 2007-03-19 at 14:00 +0100, Johannes Schindelin wrote:
> > Maybe with a git.gui config option (like merge.tool)?
> > Or by specifying on the commandline:
> > 
> > git diff --gui=<my-gui-differ> ...
> > 
> > And <my-gui-differ> = xxdiff | kompare | tkdiff | ...
> 
> Have you actually looked at the patch I sent? It is more logical to say 
> "git -p=<bla> diff ..." when the option "-p" (without "=") already exists.

I have, and I can't see your patch doing what I want.
Sorry if I haven't made myself clear what I want, but I was thinking
about a shortcut for something like the following example sequence:

$ git show v1.4.0:git.c > git.c.v1.4.0
$ git show v1.4.4:git.c > git.c.v1.4.4
$ tkdiff git.c.v1.4.0 git.c.v1.4.4
$ rm git.c.v1.4.0 git.c.v1.4.4

Replace tkdiff with the differ of your choice.

At least for comparing 2 single blobs that behavior should be well
defined. For comparing multiple blobs, checking them out in 2 separate
directories and starting the differ with the directories could work, but
I'm more after the single-file case for now ... and that's also the one
that should be easy to start from gitk.

If there's a way to do that by setting the pager I'll be happy to do
so ;-)

> Ciao,
> Dscho

-- 
best regards

  Ray

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

* RE: [wishlist] graphical diff
  2007-03-19 16:44         ` Raimund Bauer
@ 2007-03-19 16:49           ` Johannes Schindelin
  2007-03-19 20:29             ` Raimund Bauer
  0 siblings, 1 reply; 11+ messages in thread
From: Johannes Schindelin @ 2007-03-19 16:49 UTC (permalink / raw)
  To: Raimund Bauer; +Cc: 'Robin Rosenberg', 'git'

Hi,

On Mon, 19 Mar 2007, Raimund Bauer wrote:

> $ git show v1.4.0:git.c > git.c.v1.4.0
> $ git show v1.4.4:git.c > git.c.v1.4.4
> $ tkdiff git.c.v1.4.0 git.c.v1.4.4
> $ rm git.c.v1.4.0 git.c.v1.4.4

This almost looks like a script! Why don't you make it one?

Ciao,
Dscho

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

* RE: [wishlist] graphical diff
  2007-03-19 16:49           ` Johannes Schindelin
@ 2007-03-19 20:29             ` Raimund Bauer
  0 siblings, 0 replies; 11+ messages in thread
From: Raimund Bauer @ 2007-03-19 20:29 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: 'Robin Rosenberg', 'git'

On Mon, 2007-03-19 at 17:49 +0100, Johannes Schindelin wrote:
> Hi,
> 
> On Mon, 19 Mar 2007, Raimund Bauer wrote:
> 
> > $ git show v1.4.0:git.c > git.c.v1.4.0
> > $ git show v1.4.4:git.c > git.c.v1.4.4
> > $ tkdiff git.c.v1.4.0 git.c.v1.4.4
> > $ rm git.c.v1.4.0 git.c.v1.4.4
> 
> This almost looks like a script! Why don't you make it one?

Because I had hoped that someone more familiar with git and scripting
than me can come up with something, that
1.) also works in the multi-file case
2.) can take all the usual object and revision specifiers that git diff
takes.

And then there's gitk integration ...

But I'll take a look at it ;-)

> Ciao,
> Dscho

-- 
best regards

  Ray

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

end of thread, other threads:[~2007-03-19 20:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-18 13:16 [wishlist] graphical diff Raimund Bauer
2007-03-18 15:06 ` Robin Rosenberg
2007-03-18 23:09   ` Johannes Schindelin
2007-03-18 23:51     ` Robin Rosenberg
2007-03-19  0:09       ` Johannes Schindelin
2007-03-19  8:14     ` Raimund Bauer
2007-03-19 13:00       ` Johannes Schindelin
2007-03-19 16:44         ` Raimund Bauer
2007-03-19 16:49           ` Johannes Schindelin
2007-03-19 20:29             ` Raimund Bauer
2007-03-18 21:39 ` Christian MICHON

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).