Skip to content

Commit 1def7b5

Browse files
mark987j6t
authored andcommitted
git-gui: simplify using nice(1)
git-gui invokes some long running commands using "nice git $cmd" if nice is found and works, otherwise just "git $cmd". The current code is more complex than needed; let's simplify it. Signed-off-by: Mark Levedahl <[email protected]> Signed-off-by: Johannes Sixt <[email protected]>
1 parent e369dbe commit 1def7b5

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

git-gui.sh

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -579,21 +579,6 @@ proc open_cmd_pipe {cmd path} {
579579
return [open |$run r]
580580
}
581581

582-
proc _lappend_nice {cmd_var} {
583-
global _nice
584-
upvar $cmd_var cmd
585-
586-
if {![info exists _nice]} {
587-
set _nice [_which nice]
588-
if {[catch {safe_exec [list $_nice git version]}]} {
589-
set _nice {}
590-
}
591-
}
592-
if {$_nice ne {}} {
593-
lappend cmd $_nice
594-
}
595-
}
596-
597582
proc git {args} {
598583
git_redir $args {}
599584
}
@@ -627,15 +612,14 @@ proc git_read {cmd {redir {}}} {
627612
return [safe_open_command $cmdp $redir]
628613
}
629614

630-
proc git_read_nice {cmd} {
631-
global _git
632-
set opt [list]
633-
634-
_lappend_nice opt
635-
636-
set cmdp [concat [list $_git] $cmd]
615+
set _nice [list [_which nice]]
616+
if {[catch {safe_exec [list {*}$_nice git version]}]} {
617+
set _nice {}
618+
}
637619

638-
return [safe_open_command [concat $opt $cmdp]]
620+
proc git_read_nice {cmd} {
621+
set cmdp [list {*}$::_nice $::_git {*}$cmd]
622+
return [safe_open_command $cmdp]
639623
}
640624

641625
proc git_write {cmd} {

0 commit comments

Comments
 (0)