From 8b7e5d76e836396a097bb6f61cf930ea872a7bd3 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 25 Oct 2005 13:01:42 -0700 Subject: [PATCH] [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 Signed-off-by: Paul Mackerras --- gitk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitk b/gitk index f1ea4e1..a9d37d9 100755 --- a/gitk +++ b/gitk @@ -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 -- 2.23.0