All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Levedahl <mlevedahl@gmail.com>
To: git@vger.kernel.org
Cc: j6t@kdbg.org, Mark Levedahl <mlevedahl@gmail.com>
Subject: [PATCH] git-gui: simplify using nice
Date: Wed, 20 Aug 2025 11:24:51 -0400	[thread overview]
Message-ID: <20250820152451.20872-1-mlevedahl@gmail.com> (raw)

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


             reply	other threads:[~2025-08-20 15:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 15:24 Mark Levedahl [this message]
2025-08-20 15:41 ` [PATCH] git-gui: simplify using nice Kristoffer Haugsbakk
2025-08-20 16:50 ` [PATCH v2] git-gui: simplify using nice(1) Mark Levedahl
2025-08-21 18:59   ` Johannes Sixt
2025-08-21 19:19     ` Mark Levedahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250820152451.20872-1-mlevedahl@gmail.com \
    --to=mlevedahl@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.