aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Levedahl <mlevedahl@gmail.com>2024-02-12 22:03:30 -0500
committerMark Levedahl <mlevedahl@gmail.com>2025-07-18 23:48:06 -0400
commit182e2c405f16ea491fdf3a25c6be4fa2b7fc6e47 (patch)
tree1b993a91bad0545e8e059adf08abf4be51b8334e
parentf87a36b697ca7a9415fa8773a06d943d84db1b80 (diff)
downloadgit-182e2c405f16ea491fdf3a25c6be4fa2b7fc6e47.tar.gz
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>
-rwxr-xr-xgit-gui.sh15
1 files changed, 1 insertions, 14 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 0347d488a7..1e4c7601b9 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1278,20 +1278,7 @@ if {![file isdirectory $_gitdir]} {
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 {}} {