summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c0d2c38)
raw | patch | inline | side by side (parent: c0d2c38)
author | Pat Thoyts <patthoyts@users.sourceforge.net> | |
Thu, 7 Oct 2010 21:28:45 +0000 (22:28 +0100) | ||
committer | Pat Thoyts <patthoyts@users.sourceforge.net> | |
Thu, 7 Oct 2010 21:28:45 +0000 (22:28 +0100) |
Rather than attempting to trim off all the non-version number suffixes
from the 'git version' result, let us scan along from the beginning until
we find a non-numeric part and stop there. Any such dot-version number will
be compatible with the Tcl package version comparison command which is the
aim of this code.
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
from the 'git version' result, let us scan along from the beginning until
we find a non-numeric part and stop there. Any such dot-version number will
be compatible with the Tcl package version comparison command which is the
aim of this code.
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
git-gui.sh | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index ea262a2bac60a7aa577743ce49d933d871daf434..25229a4073b90b3cf9071b9633307061a648c9d0 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
exit 1
}
+proc get_trimmed_version {s} {
+ set r {}
+ foreach x [split $s -._] {
+ if {[string is integer -strict $x]} {
+ lappend r $x
+ } else {
+ break
+ }
+ }
+ return [join $r .]
+}
set _real_git_version $_git_version
-regsub -- {[\-\.]dirty$} $_git_version {} _git_version
-regsub {\.[0-9]+\.g[0-9a-f]+$} $_git_version {} _git_version
-regsub {\.[a-zA-Z]+\.?[0-9]+$} $_git_version {} _git_version
-regsub {\.GIT$} $_git_version {} _git_version
-regsub {\.[a-zA-Z]+\.?[0-9]+$} $_git_version {} _git_version
+set _git_version [get_trimmed_version $_git_version]
if {![regexp {^[1-9]+(\.[0-9]+)+$} $_git_version]} {
catch {wm withdraw .}