diff --git a/gitk-git/gitk b/gitk-git/gitk index 7a4483566f4f95..2d5065b88b1b1f 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -12625,7 +12625,9 @@ set cdup {} if {[expr {[exec git rev-parse --is-inside-work-tree] == "true"}]} { set cdup [exec git rev-parse --show-cdup] } -set worktree [exec git rev-parse --show-toplevel] +if {$hasworktree} { + set worktree [exec git rev-parse --show-toplevel] +} setcoords makewindow catch {