diff --git a/git-gui.sh b/git-gui.sh
index 2077261e647904d9871479411263d0fdcbb79662..2127557f9d595020765dbf318051375be8c7e390 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
return {}
}
return {}
}
+proc _lappend_nice {cmd_var} {
+ global _nice
+ upvar $cmd_var cmd
+
+ if {![info exists _nice]} {
+ set _nice [_which nice]
+ }
+ if {$_nice ne {}} {
+ lappend cmd $_nice
+ }
+}
+
proc git {args} {
set opt [list exec]
while {1} {
switch -- [lindex $args 0] {
--nice {
proc git {args} {
set opt [list exec]
while {1} {
switch -- [lindex $args 0] {
--nice {
- global _nice
- if {$_nice ne {}} {
- lappend opt $_nice
- }
+ _lappend_nice opt
}
default {
}
default {
error $err
}
}
error $err
}
}
+ fconfigure $fd -eofchar {}
return $fd
}
return $fd
}
while {1} {
switch -- [lindex $args 0] {
--nice {
while {1} {
switch -- [lindex $args 0] {
--nice {
- global _nice
- if {$_nice ne {}} {
- lappend opt $_nice
- }
+ _lappend_nice opt
}
--stderr {
}
--stderr {
while {1} {
switch -- [lindex $args 0] {
--nice {
while {1} {
switch -- [lindex $args 0] {
--nice {
- global _nice
- if {$_nice ne {}} {
- lappend opt $_nice
- }
+ _lappend_nice opt
}
default {
}
default {
error_popup "Cannot find git in PATH."
exit 1
}
error_popup "Cannot find git in PATH."
exit 1
}
-set _nice [_which nice]
######################################################################
##
######################################################################
##
error_popup "Cannot parse Git version string:\n\n$_git_version"
exit 1
}
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 {\.[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
proc git-version {args} {
global _git_version
if {[catch {set fd [open $f r]}]} {
return 0
}
if {[catch {set fd [open $f r]}]} {
return 0
}
+ fconfigure $fd -eofchar {}
set content [string trim [read $fd]]
close $fd
regsub -all -line {[ \r\t]+$} $content {} content
set content [string trim [read $fd]]
close $fd
regsub -all -line {[ \r\t]+$} $content {} content
# -- Only suggest a gc run if we are going to stay running.
#
if {[is_enabled multicommit]} {
# -- Only suggest a gc run if we are going to stay running.
#
if {[is_enabled multicommit]} {
- set object_limit 2000
- if {[is_Windows]} {set object_limit 200}
- regexp {^([0-9]+) objects,} [git count-objects] _junk objects_current
+ set object_limit 8
+ if {[is_Windows]} {
+ set object_limit 1
+ }
+ set objects_current [llength [glob \
+ -directory [gitdir objects 42] \
+ -nocomplain \
+ -tails \
+ -- \
+ *]]
if {$objects_current >= $object_limit} {
if {$objects_current >= $object_limit} {
+ set objects_current [expr {$objects_current * 256}]
+ set object_limit [expr {$object_limit * 256}]
if {[ask_popup \
if {[ask_popup \
- "This repository currently has $objects_current loose objects.
+ "This repository currently has approximately $objects_current loose objects.
To maintain optimal performance it is strongly recommended that you compress the database when more than $object_limit loose objects exist.
To maintain optimal performance it is strongly recommended that you compress the database when more than $object_limit loose objects exist.
do_gc
}
}
do_gc
}
}
- unset object_limit _junk objects_current
+ unset object_limit objects_current
}
lock_index begin-read
}
lock_index begin-read
+if {![winfo ismapped .]} {
+ wm deiconify .
+}
after 1 do_rescan
after 1 do_rescan