Skip to content

Commit

Permalink
gitk: Fix "External diff" with separate work tree
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Martin von Zweigbergk authored and Paul Mackerras committed Jul 24, 2011
1 parent 0a2a979 commit 784b7e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gitk
Original file line number Diff line number Diff line change
Expand Up @@ -3364,10 +3364,10 @@ proc save_file_from_commit {filename output what} {

proc external_diff_get_one_file {diffid filename diffdir} {
global nullid nullid2 nullfile
global gitdir
global worktree

if {$diffid == $nullid} {
set difffile [file join [file dirname $gitdir] $filename]
set difffile [file join $worktree $filename]
if {[file exists $difffile]} {
return $difffile
}
Expand Down Expand Up @@ -11650,6 +11650,7 @@ set cdup {}
if {$isworktree} {
set cdup [exec git rev-parse --show-cdup]
}
set worktree [exec git rev-parse --show-toplevel]
setcoords
makewindow
catch {
Expand Down

0 comments on commit 784b7e2

Please sign in to comment.