aboutsummaryrefslogtreecommitdiffstats
path: root/git-gui.sh
diff options
context:
space:
mode:
authorMark Levedahl <mlevedahl@gmail.com>2024-02-12 23:32:44 -0500
committerMark Levedahl <mlevedahl@gmail.com>2025-07-17 16:59:04 -0400
commit77f648edb69dba164e2e32f33ab009fa33c3d9f1 (patch)
tree64b9b906f0526998a9692a6c55698ea650b9e816 /git-gui.sh
parentMerge branch 'js/fix-open-exec-git' (diff)
downloadgit-77f648edb69dba164e2e32f33ab009fa33c3d9f1.tar.gz
git-77f648edb69dba164e2e32f33ab009fa33c3d9f1.zip
git-gui: require git >= 2.36
git-gui since commit d6967022 explicitly requires version >= 1.5.0, and this coded requirement has never been changed. But, since 0730a5a3a 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 <mlevedahl@gmail.com>
Diffstat (limited to '')
-rwxr-xr-xgit-gui.sh49
1 files changed, 16 insertions, 33 deletions
diff --git a/git-gui.sh b/git-gui.sh
index c77c05edde..d896382b8c 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -992,6 +992,8 @@ if {$_git eq {}} {
##
## version check
+set MIN_GIT_VERSION 2.36
+
if {[catch {set _git_version [git --version]} err]} {
catch {wm withdraw .}
tk_messageBox \
@@ -1002,9 +1004,10 @@ if {[catch {set _git_version [git --version]} err]} {
$err
-[appname] requires Git 1.5.0 or later."
+[appname] requires Git $MIN_GIT_VERSION or later."
exit 1
}
+
if {![regsub {^git version } $_git_version {} _git_version]} {
catch {wm withdraw .}
tk_messageBox \
@@ -1029,25 +1032,19 @@ proc get_trimmed_version {s} {
set _real_git_version $_git_version
set _git_version [get_trimmed_version $_git_version]
-if {![regexp {^[1-9]+(\.[0-9]+)+$} $_git_version]} {
- catch {wm withdraw .}
- if {[tk_messageBox \
- -icon warning \
- -type yesno \
- -default no \
- -title "[appname]: warning" \
- -message [mc "Git version cannot be determined.
-
-%s claims it is version '%s'.
-
-%s requires at least Git 1.5.0 or later.
+if {[catch {set vcheck [package vcompare $_git_version $MIN_GIT_VERSION]}] ||
+ [expr $vcheck < 0] } {
-Assume '%s' is version 1.5.0?
-" $_git $_real_git_version [appname] $_real_git_version]] eq {yes}} {
- set _git_version 1.5.0
- } else {
- exit 1
- }
+ set msg1 [mc "Insufficient git version, require: "]
+ set msg2 [mc "git returned:"]
+ set message "$msg1 $MIN_GIT_VERSION\n$msg2 $_real_git_version"
+ catch {wm withdraw .}
+ tk_messageBox \
+ -icon error \
+ -type ok \
+ -title [mc "git-gui: fatal error"] \
+ -message $message
+ exit 1
}
unset _real_git_version
@@ -1095,20 +1092,6 @@ proc git-version {args} {
}
}
-if {[git-version < 1.5]} {
- catch {wm withdraw .}
- tk_messageBox \
- -icon error \
- -type ok \
- -title [mc "git-gui: fatal error"] \
- -message "[appname] requires Git 1.5.0 or later.
-
-You are using [git-version]:
-
-[git --version]"
- exit 1
-}
-
######################################################################
##
## configure our library