Skip to content

Commit 182e2c4

Browse files
committed
git-gui: git rev-parse knows show_toplevel
git-gui has its own code to determine the worktree root for git-versions earlier than 1.7.0, where git rev-parse learned this function. git-gui requires git v2.36 or later, so delete the now obsolete alternate code. Signed-off-by: Mark Levedahl <[email protected]>
1 parent f87a36b commit 182e2c4

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

git-gui.sh

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,20 +1278,7 @@ if {![file isdirectory $_gitdir]} {
12781278
load_config 0
12791279
apply_config
12801280

1281-
# v1.7.0 introduced --show-toplevel to return the canonical work-tree
1282-
if {[package vcompare $_git_version 1.7.0] >= 0} {
1283-
set _gitworktree [git rev-parse --show-toplevel]
1284-
} else {
1285-
# try to set work tree from environment, core.worktree or use
1286-
# cdup to obtain a relative path to the top of the worktree. If
1287-
# run from the top, the ./ prefix ensures normalize expands pwd.
1288-
if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} {
1289-
set _gitworktree [get_config core.worktree]
1290-
if {$_gitworktree eq ""} {
1291-
set _gitworktree [file normalize ./[git rev-parse --show-cdup]]
1292-
}
1293-
}
1294-
}
1281+
set _gitworktree [git rev-parse --show-toplevel]
12951282

12961283
if {$_prefix ne {}} {
12971284
if {$_gitworktree eq {}} {

0 commit comments

Comments
 (0)