[PATCH] Make "gitk" work better with dense revlists

To generate the diff for a commit, gitk used to do

	git-diff-tree -p -C $p $id

(and same thing to generate filenames, except using just "-r" there) which
does actually generate the diff from the parent to the $id, exactly like
it meant to do.

However, that really sucks with --dense, where the "parent" information
has all been rewritten to point to the previous commit. The diff actually
works exactly right, but now it's the diff of the _whole_ sequence of
commits all the way to the previous commit that last changed the file(s)
that we are looking at.

And that's really not what we want 99.9% of the time, even if it may be
perfectly sensible. Not only will the diff not actually match the commit
message, but it will usually be _huge_, and all of it will be totally
uninteresting to us, since we were only interested in a particular set of
files.

It also doesn't match what we do when we write the patch to a file.

So this makes gitk just show the diff of _that_ commit.

We might even want to have some way to limit the diff to only the
filenames we're interested in, but it's often nice to see what else
changed at the same time, so that's secondary.

The merge diff handling is left alone, although I think that should also
be changed to only look at what that _particular_ merge did, not what it
did when compared to the faked-out parents.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
Linus Torvalds 2005-10-25 13:01:42 -07:00 committed by Paul Mackerras
parent 9e026d3967
commit 8b7e5d76e8

4
gitk
View File

@ -2806,7 +2806,7 @@ proc gettreediffs {ids} {
set treediff {}
set id [lindex $ids 0]
set p [lindex $ids 1]
if [catch {set gdtf [open "|git-diff-tree -r $p $id" r]}] return
if [catch {set gdtf [open "|git-diff-tree -r $id" r]}] return
fconfigure $gdtf -blocking 0
fileevent $gdtf readable [list gettreediffline $gdtf $ids]
}
@ -2842,7 +2842,7 @@ proc getblobdiffs {ids} {
set id [lindex $ids 0]
set p [lindex $ids 1]
set env(GIT_DIFF_OPTS) $diffopts
set cmd [list | git-diff-tree -r -p -C $p $id]
set cmd [list | git-diff-tree -r -p -C $id]
if {[catch {set bdf [open $cmd r]} err]} {
puts "error getting diffs: $err"
return