diff --git a/gitk-git/gitk b/gitk-git/gitk index b805ec53ed0571..cd681dc4c46257 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -12631,7 +12631,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 if {$::tcl_platform(platform) eq {windows} && [file exists $gitk_prefix/etc/git.ico]} {