git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-gui: simplify using nice

From
Mark Levedahl <mlevedahl@gmail.com>
Date
Aug 20, 2025, 15:24 UTC
Message-ID
<20250820152451.20872-1-mlevedahl@gmail.com>

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, lets simplify it.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
 git-gui.sh | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index 4528b22..5ee08d5 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -578,21 +578,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 {}
 }
@@ -626,15 +611,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 [_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} {
-- 
2.51.0.99.15
Next: Kristoffer Haugsbakk
Message 1 of 5 in “git-gui: simplify using nice”
  1. git-gui: simplify using niceMark Levedahl, Aug 20, 2025
  2. Kristoffer HaugsbakkAug 20, 2025
  3. git-gui: simplify using nice(1)Mark Levedahl, Aug 20, 2025
  4. Johannes SixtAug 21, 2025
  5. Mark LevedahlAug 21, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.