Skip to content

Commit 77f648e

Browse files
committed
git-gui: require git >= 2.36
git-gui since commit d696702 explicitly requires version >= 1.5.0, and this coded requirement has never been changed. But, since 0730a5a git-gui actually requires git 2.36, providing 'git hook run.' git-gui throws an error if that command is not supported. So, let's update the requirement checking code to 2.36, and throw a more useful error if this is not met. Signed-off-by: Mark Levedahl <[email protected]>
1 parent 3f07230 commit 77f648e

File tree

1 file changed

+16
-33
lines changed

1 file changed

+16
-33
lines changed

git-gui.sh

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,8 @@ if {$_git eq {}} {
992992
##
993993
## version check
994994

995+
set MIN_GIT_VERSION 2.36
996+
995997
if {[catch {set _git_version [git --version]} err]} {
996998
catch {wm withdraw .}
997999
tk_messageBox \
@@ -1002,9 +1004,10 @@ if {[catch {set _git_version [git --version]} err]} {
10021004
10031005
$err
10041006
1005-
[appname] requires Git 1.5.0 or later."
1007+
[appname] requires Git $MIN_GIT_VERSION or later."
10061008
exit 1
10071009
}
1010+
10081011
if {![regsub {^git version } $_git_version {} _git_version]} {
10091012
catch {wm withdraw .}
10101013
tk_messageBox \
@@ -1029,25 +1032,19 @@ proc get_trimmed_version {s} {
10291032
set _real_git_version $_git_version
10301033
set _git_version [get_trimmed_version $_git_version]
10311034

1032-
if {![regexp {^[1-9]+(\.[0-9]+)+$} $_git_version]} {
1033-
catch {wm withdraw .}
1034-
if {[tk_messageBox \
1035-
-icon warning \
1036-
-type yesno \
1037-
-default no \
1038-
-title "[appname]: warning" \
1039-
-message [mc "Git version cannot be determined.
1040-
1041-
%s claims it is version '%s'.
1042-
1043-
%s requires at least Git 1.5.0 or later.
1035+
if {[catch {set vcheck [package vcompare $_git_version $MIN_GIT_VERSION]}] ||
1036+
[expr $vcheck < 0] } {
10441037

1045-
Assume '%s' is version 1.5.0?
1046-
" $_git $_real_git_version [appname] $_real_git_version]] eq {yes}} {
1047-
set _git_version 1.5.0
1048-
} else {
1049-
exit 1
1050-
}
1038+
set msg1 [mc "Insufficient git version, require: "]
1039+
set msg2 [mc "git returned:"]
1040+
set message "$msg1 $MIN_GIT_VERSION\n$msg2 $_real_git_version"
1041+
catch {wm withdraw .}
1042+
tk_messageBox \
1043+
-icon error \
1044+
-type ok \
1045+
-title [mc "git-gui: fatal error"] \
1046+
-message $message
1047+
exit 1
10511048
}
10521049
unset _real_git_version
10531050

@@ -1095,20 +1092,6 @@ proc git-version {args} {
10951092
}
10961093
}
10971094

1098-
if {[git-version < 1.5]} {
1099-
catch {wm withdraw .}
1100-
tk_messageBox \
1101-
-icon error \
1102-
-type ok \
1103-
-title [mc "git-gui: fatal error"] \
1104-
-message "[appname] requires Git 1.5.0 or later.
1105-
1106-
You are using [git-version]:
1107-
1108-
[git --version]"
1109-
exit 1
1110-
}
1111-
11121095
######################################################################
11131096
##
11141097
## configure our library

0 commit comments

Comments
 (0)