]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: simplify using nice(1)
authorMark Levedahl <mlevedahl@gmail.com>
Wed, 20 Aug 2025 16:50:21 +0000 (12:50 -0400)
committerJohannes Sixt <j6t@kdbg.org>
Thu, 21 Aug 2025 18:49:41 +0000 (20:49 +0200)
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 <mlevedahl@gmail.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
git-gui.sh

index 9e0c47f842086b1dac7f468e3811117bfeedfd1d..c827d9d3b899033807a296bed9e867ea337caf7d 100755 (executable)
@@ -579,21 +579,6 @@ proc open_cmd_pipe {cmd path} {
        return [open |$run r]
 }
 
-proc _lappend_nice {cmd_var} {
-       global _nice
-       upvar $cmd_var cmd
-
-       if {![info exists _nice]} {
-               set _nice [_which nice]
-               if {[catch {safe_exec [list $_nice git version]}]} {
-                       set _nice {}
-               }
-       }
-       if {$_nice ne {}} {
-               lappend cmd $_nice
-       }
-}
-
 proc git {args} {
        git_redir $args {}
 }
@@ -627,15 +612,14 @@ proc git_read {cmd {redir {}}} {
        return [safe_open_command $cmdp $redir]
 }
 
-proc git_read_nice {cmd} {
-       global _git
-       set opt [list]
-
-       _lappend_nice opt
-
-       set cmdp [concat [list $_git] $cmd]
+set _nice [list [_which nice]]
+if {[catch {safe_exec [list {*}$_nice git version]}]} {
+       set _nice {}
+}
 
-       return [safe_open_command [concat $opt $cmdp]]
+proc git_read_nice {cmd} {
+       set cmdp [list {*}$::_nice $::_git {*}$cmd]
+       return [safe_open_command $cmdp]
 }
 
 proc git_write {cmd} {