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 <mlevedahl@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Mark Levedahl committed
Aug 20, 2025 at 12:50 UTC
1def7b5705885f8cf11afac1d37000c0c88c6c3f
1 file changed
+7
-23
git-gui.sh
+7
-23
@@ -579,21 +579,6 @@ proc open_cmd_pipe {cmd path} {
579
return [open |$run r]
580
}
581
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
-
582
proc git {args} {
583
git_redir $args {}
584
}
@@ -627,15 +612,14 @@ proc git_read {cmd {redir {}}} {
612
return [safe_open_command $cmdp $redir]
613
}
614
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
+}
619
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]
623
}
624
625
proc git_write {cmd} {