From: Shawn O. Pearce Date: Wed, 18 Jul 2007 03:09:31 +0000 (-0400) Subject: git-gui: Let the user continue even if we cannot understand git version X-Git-Tag: gitgui-0.8.0~42 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=301dfaa9daeb64c66d616efe50fac29d542c9414;p=git.git git-gui: Let the user continue even if we cannot understand git version Some users may do odd things, like tag their own private version of Git with an annotated tag such as 'testver', then compile that git and try to use it with git-gui. In such a case `git --version` will give us 'git version testver', which is not a numeric argument that we can pass off to our version comparsion routine. We now check that the cleaned up git version is a going to pass the version comparsion routine without failure. If it has a non-numeric component, or lacks at least a minor revision then we ask the user to confirm they really want to use this version of git within git-gui. If they do we shall assume it is git 1.5.0 and run with only the code that will support. Signed-off-by: Shawn O. Pearce --- diff --git a/git-gui.sh b/git-gui.sh index cd2b09372..2127557f9 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -547,11 +547,35 @@ if {![regsub {^git version } $_git_version {} _git_version]} { error_popup "Cannot parse Git version string:\n\n$_git_version" exit 1 } + +set _real_git_version $_git_version regsub -- {-dirty$} $_git_version {} _git_version regsub {\.[0-9]+\.g[0-9a-f]+$} $_git_version {} _git_version regsub {\.rc[0-9]+$} $_git_version {} _git_version regsub {\.GIT$} $_git_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 "Git version cannot be determined. + +$_git claims it is version '$_real_git_version'. + +[appname] requires at least Git 1.5.0 or later. + +Assume '$_real_git_version' is version 1.5.0? +"] eq {yes}} { + set _git_version 1.5.0 + } else { + exit 1 + } +} +unset _real_git_version + proc git-version {args} { global _git_version @@ -2586,4 +2610,7 @@ Compress the database now?"] eq yes} { } lock_index begin-read +if {![winfo ismapped .]} { + wm deiconify . +} after 1 do_rescan