summaryrefslogtreecommitdiff
path: root/git-gui.sh
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-07-18 02:31:16 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-07-18 02:31:16 (GMT)
commit6f62b4f782c51bdf0dfdef3da5b5049c9006ff70 (patch)
tree8cfe48ba01cc06cbbd4c26509000611a4b27908f /git-gui.sh
parent91464dfb102d6143182d8f312b68486e9dceb103 (diff)
downloadgit-6f62b4f782c51bdf0dfdef3da5b5049c9006ff70.zip
git-6f62b4f782c51bdf0dfdef3da5b5049c9006ff70.tar.gz
git-6f62b4f782c51bdf0dfdef3da5b5049c9006ff70.tar.bz2
git-gui: Delay searching for 'nice' until its really asked for
Not every caller of 'git' or 'git_pipe' wants to use nice to lower the priority of the process its executing. In many cases we may never use the nice process to launch git. So we can avoid searching our $PATH to locate a suitable nice if we'll never actually use it. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh28
1 files changed, 15 insertions, 13 deletions
diff --git a/git-gui.sh b/git-gui.sh
index ebc2708..5ca946a 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -367,16 +367,25 @@ proc _which {what} {
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 {
- global _nice
- if {$_nice ne {}} {
- lappend opt $_nice
- }
+ _lappend_nice opt
}
default {
@@ -424,10 +433,7 @@ proc git_read {args} {
while {1} {
switch -- [lindex $args 0] {
--nice {
- global _nice
- if {$_nice ne {}} {
- lappend opt $_nice
- }
+ _lappend_nice opt
}
--stderr {
@@ -455,10 +461,7 @@ proc git_write {args} {
while {1} {
switch -- [lindex $args 0] {
--nice {
- global _nice
- if {$_nice ne {}} {
- lappend opt $_nice
- }
+ _lappend_nice opt
}
default {
@@ -525,7 +528,6 @@ if {$_git eq {}} {
error_popup "Cannot find git in PATH."
exit 1
}
-set _nice [_which nice]
######################################################################
##