load_config 0
apply_config
-# v1.7.0 introduced --show-toplevel to return the canonical work-tree
-if {[package vcompare $_git_version 1.7.0] >= 0} {
- set _gitworktree [git rev-parse --show-toplevel]
-} else {
- # try to set work tree from environment, core.worktree or use
- # cdup to obtain a relative path to the top of the worktree. If
- # run from the top, the ./ prefix ensures normalize expands pwd.
- if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} {
- set _gitworktree [get_config core.worktree]
- if {$_gitworktree eq ""} {
- set _gitworktree [file normalize ./[git rev-parse --show-cdup]]
- }
- }
-}
+set _gitworktree [git rev-parse --show-toplevel]
if {$_prefix ne {}} {
if {$_gitworktree eq {}} {