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 <mlevedahl@gmail.com>

Mark Levedahl committed Feb 12, 2024 at 22:03 UTC 182e2c405f16ea491fdf3a25c6be4fa2b7fc6e47
1 file changed +1 -14
git-gui.sh
+1 -14
@@ -1278,20 +1278,7 @@ if {![file isdirectory $_gitdir]} {
1278 load_config 0
1279 apply_config
1280
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]
1282
1283 if {$_prefix ne {}} {
1284 if {$_gitworktree eq {}} {