Skip to content

Commit 784b7e2

Browse files
Martin von Zweigbergkpaulusmack
authored andcommitted
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 <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 0a2a979 commit 784b7e2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gitk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3364,10 +3364,10 @@ proc save_file_from_commit {filename output what} {
33643364

33653365
proc external_diff_get_one_file {diffid filename diffdir} {
33663366
global nullid nullid2 nullfile
3367-
global gitdir
3367+
global worktree
33683368

33693369
if {$diffid == $nullid} {
3370-
set difffile [file join [file dirname $gitdir] $filename]
3370+
set difffile [file join $worktree $filename]
33713371
if {[file exists $difffile]} {
33723372
return $difffile
33733373
}
@@ -11650,6 +11650,7 @@ set cdup {}
1165011650
if {$isworktree} {
1165111651
set cdup [exec git rev-parse --show-cdup]
1165211652
}
11653+
set worktree [exec git rev-parse --show-toplevel]
1165311654
setcoords
1165411655
makewindow
1165511656
catch {

0 commit comments

Comments
 (0)