aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-02-13 23:15:25 -0500
committerShawn O. Pearce <spearce@spearce.org>2007-02-13 23:15:25 -0500
commit54acdd95b81d3675381a749e7cd7fc14956853c3 (patch)
tree176aec1e0ceb65c1be2c00f955dd004a90774ca4
parent81347223066fee64997cbb731925bc8c1abd35d7 (diff)
downloadgit-54acdd95b81d3675381a749e7cd7fc14956853c3.tar.gz
git-54acdd95b81d3675381a749e7cd7fc14956853c3.tar.xz
git-gui: Basic version check to ensure git 1.5.0 or later is used.
This is a very crude (but hopefully effective) check against the `git` executable found in our PATH. Some of the subcommands and options that git-gui requires to be present to operate were created during the 1.5.0 development cycle, so 1.5 is the minimum version of git that we can expect to support. There actually are early releases of 1.5 (e.g. 1.5.0-rc0) that don't have everything we expect (like `blame --incremental`) but these are purely academic at this point. 1.5.0 final was tagged and released just a few hours ago. The release candidates will (hopefully) fade into the dark quickly. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rwxr-xr-xgit-gui.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 7ecb98b90..444cc0afc 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -297,6 +297,38 @@ proc ask_popup {msg} {
######################################################################
##
+## version check
+
+set req_maj 1
+set req_min 5
+
+if {[catch {set v [git --version]} err]} {
+ catch {wm withdraw .}
+ error_popup "Cannot determine Git version:
+
+$err
+
+[appname] requires Git $req_maj.$req_min or later."
+ exit 1
+}
+if {[regexp {^git version (\d+)\.(\d+)} $v _junk act_maj act_min]} {
+ if {$act_maj < $req_maj
+ || ($act_maj == $req_maj && $act_min < $req_min)} {
+ catch {wm withdraw .}
+ error_popup "[appname] requires Git $req_maj.$req_min or later.
+
+You are using $v."
+ exit 1
+ }
+} else {
+ catch {wm withdraw .}
+ error_popup "Cannot parse Git version string:\n\n$v"
+ exit 1
+}
+unset -nocomplain v _junk act_maj act_min req_maj req_min
+
+######################################################################
+##
## repository setup
if { [catch {set _gitdir $env(GIT_DIR)}]