From: Chris Packham <judge.packham@gmail.com>
To: patthoyts@users.sourceforge.net, git@vger.kernel.org
Cc: Chris Packham <judge.packham@gmail.com>
Subject: [GIT GUI PATCH] git-gui: unconditionally use rev-parse --show-toplevel
Date: Tue, 29 Apr 2014 22:58:22 +1200 [thread overview]
Message-ID: <1398769102-6401-1-git-send-email-judge.packham@gmail.com> (raw)
In-Reply-To: <CAFOYHZD=wxwm0nLhtZwvXDAhQ23j0C5maArQunc0CVe_-SF_mQ@mail.gmail.com>
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
check.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
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.
git-gui.sh | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index cf2209b..9ded5b9 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1282,23 +1282,11 @@ if {![file isdirectory $_gitdir]} {
load_config 0
apply_config
-# 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 --show-toplevel]]}
- } 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 --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 {}} {
--
1.8.2.rc1.4.g27db5a0
next prev parent reply other threads:[~2014-04-29 10:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-29 2:56 git gui error with relocated repository Chris Packham
2014-04-29 4:23 ` Chris Packham
2014-04-29 10:58 ` Chris Packham [this message]
2014-05-06 12:10 ` Pat Thoyts
2014-05-07 7:28 ` Chris Packham
2014-05-07 7:49 ` Chris Packham
2014-05-13 21:24 ` [GIT GUI PATCH] git-gui: use vcompare when comparing the git version Jens Lehmann
2014-05-14 7:46 ` Chris Packham
2014-05-14 7:49 ` Jens Lehmann
2014-05-14 19:22 ` Junio C Hamano
2014-05-14 21:49 ` Junio C Hamano
2014-05-17 12:23 ` Pat Thoyts
2014-05-17 19:49 ` [GIT GUI PATCH v2] git-gui: tolerate major version changes " Jens Lehmann
2014-05-18 0:31 ` Chris Packham
2014-05-18 3:01 ` Eric Sunshine
2014-05-19 17:16 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1398769102-6401-1-git-send-email-judge.packham@gmail.com \
--to=judge.packham@gmail.com \
--cc=git@vger.kernel.org \
--cc=patthoyts@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).