Previously 'git rev-parse --show-toplevel' was used to determine the
canonical work-tree only when the installed git version was detected to
be 1.7.0 or better. The fall-back logic used the core.worktree config
variable which in the case of a submodule is a relative path from the
submodule's $GIT_DIR. Unfortunately vsatisfies doesn't handle versions
like v2.0.0.rc0 so the fall-back logic is triggered.

Given the fact that git 1.7.0 was released over 4 years ago rather than
fixing the fall-back logic it seems reasonable to drop the version

Signed-off-by: Chris Packham <>
So I'm not sure if vsatisfies is failing because the version has .rc0 or
because it thinks v2.0.0 < 1.7.0. Regardless I think it's reasonably safe to
assume that people who are using the newer versions of git-gui are running new
enough versions of git.

There is also a similar section in rescan_stage2 that is checking for the
version being 1.6.3 or newer. Again I think it's probably safe to assume that
no-one is running a version of git that old (or at least no-one that wants to
run this version of git-gui). I'm not quite sure how to excercise that bit of
code so I haven't attempted to fix that. | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/ b/
index cf2209b..9ded5b9 100755
--- a/
+++ b/
@@ -1282,23 +1282,11 @@ if {![file isdirectory $_gitdir]} {
 load_config 0
-# v1.7.0 introduced --show-toplevel to return the canonical work-tree
-if {[package vsatisfies $_git_version 1.7.0]} {
-       if { [is_Cygwin] } {
-               catch {set _gitworktree [exec cygpath --windows [git rev-parse 
-       } else {
-               set _gitworktree [git rev-parse --show-toplevel]
-       }
+# Determine the canonical work-tree
+if { [is_Cygwin] } {
+       catch {set _gitworktree [exec cygpath --windows [git rev-parse 
 } 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 
-               }
-       }
+       set _gitworktree [git rev-parse --show-toplevel]
 if {$_prefix ne {}} {

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to