gitk: Fix "External diff" with separate work tree

Running "External diff" to compare the index and work tree currently brings up an empty blame view when the work tree is not the parent of the git directory. This is because the file that is taken from the work tree is assumed to be in $GIT_DIR/../<repo-relative-file-name>. Fix it by feeding the diff tool a path under $GIT_WORK_TREE instead of "$GIT_DIR/..". Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>

Martin von Zweigbergk committed Apr 4, 2011 at 22:14 UTC 784b7e2f25ce2a812d6b2dcbe4d3a2ea93484bb4
1 file changed +3 -2
gitk
+3 -2
@@ -3364,10 +3364,10 @@ proc save_file_from_commit {filename output what} {
3364
3365 proc external_diff_get_one_file {diffid filename diffdir} {
3366 global nullid nullid2 nullfile
3367 - global gitdir
3367 + global worktree
3368
3369 if {$diffid == $nullid} {
3370 - set difffile [file join [file dirname $gitdir] $filename]
3370 + set difffile [file join $worktree $filename]
3371 if {[file exists $difffile]} {
3372 return $difffile
3373 }
@@ -11650,6 +11650,7 @@ set cdup {}
11650 if {$isworktree} {
11651 set cdup [exec git rev-parse --show-cdup]
11652 }
11653 +set worktree [exec git rev-parse --show-toplevel]
11654 setcoords
11655 makewindow
11656 catch {