Skip to content

Commit

Permalink
git-gui: Basic version check to ensure git 1.5.0 or later is used.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce committed Feb 14, 2007
1 parent 8134722 commit 54acdd9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,38 @@ proc ask_popup {msg} {
-message $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
Expand Down

0 comments on commit 54acdd9

Please sign in to comment.