diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-07-17 23:09:31 -0400 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-07-17 23:09:31 -0400 |
commit | 301dfaa9daeb64c66d616efe50fac29d542c9414 (patch) | |
tree | 803bea34a5e0b9cdc417412e27fb740e34074640 | |
parent | git-gui: Change our initial GC hint to be an estimate (diff) | |
download | tgif-301dfaa9daeb64c66d616efe50fac29d542c9414.tar.xz |
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 <spearce@spearce.org>
-rwxr-xr-x | git-gui.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/git-gui.sh b/git-gui.sh index cd2b093723..2127557f9d 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 |