From 54acdd95b81d3675381a749e7cd7fc14956853c3 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 13 Feb 2007 23:15:25 -0500 Subject: [PATCH] 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 --- git-gui.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/git-gui.sh b/git-gui.sh index 7ecb98b900..444cc0afc8 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)}] -- 2.11.4.GIT