* [PATCH] git-gui: simplify using nice
@ 2025-08-20 15:24 Mark Levedahl
2025-08-20 15:41 ` Kristoffer Haugsbakk
2025-08-20 16:50 ` [PATCH v2] git-gui: simplify using nice(1) Mark Levedahl
0 siblings, 2 replies; 5+ messages in thread
From: Mark Levedahl @ 2025-08-20 15:24 UTC (permalink / raw)
To: git; +Cc: j6t, Mark Levedahl
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] git-gui: simplify using nice
2025-08-20 15:24 [PATCH] git-gui: simplify using nice Mark Levedahl
@ 2025-08-20 15:41 ` Kristoffer Haugsbakk
2025-08-20 16:50 ` [PATCH v2] git-gui: simplify using nice(1) Mark Levedahl
1 sibling, 0 replies; 5+ messages in thread
From: Kristoffer Haugsbakk @ 2025-08-20 15:41 UTC (permalink / raw)
To: Mark Levedahl, git; +Cc: Johannes Sixt
> Re: [PATCH] git-gui: simplify using nice
s/using nice/using nice(1)/ ?
On Wed, Aug 20, 2025, at 17:24, Mark Levedahl wrote:
> 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.
s/, lets simplify it/; let's simplify it/
>
> Signed-off-by: Mark Levedahl <mlevedahl@gmail•com>
--
Kristoffer Haugsbakk
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] git-gui: simplify using nice(1)
2025-08-20 15:24 [PATCH] git-gui: simplify using nice Mark Levedahl
2025-08-20 15:41 ` Kristoffer Haugsbakk
@ 2025-08-20 16:50 ` Mark Levedahl
2025-08-21 18:59 ` Johannes Sixt
1 sibling, 1 reply; 5+ messages in thread
From: Mark Levedahl @ 2025-08-20 16:50 UTC (permalink / raw)
To: git; +Cc: j6t, kristofferhaugsbakk, Mark Levedahl
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>
---
updates from v1:
- _which does not return a list, _nice must be a list to handle path
with spaces (should have been in v1, was in another patch - oops)
- Address Kristoffer Haugsbakk's comments
git-gui.sh | 30 +++++++-----------------------
1 file changed, 7 insertions(+), 23 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index 4528b22..be0b8d9 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 [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} {
--
2.51.0.99.15
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v2] git-gui: simplify using nice(1)
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
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Sixt @ 2025-08-21 18:59 UTC (permalink / raw)
To: Mark Levedahl; +Cc: kristofferhaugsbakk, git
Am 20.08.25 um 18:50 schrieb Mark Levedahl:
> 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>
> ---
> updates from v1:
> - _which does not return a list, _nice must be a list to handle path
> with spaces (should have been in v1, was in another patch - oops)
> - Address Kristoffer Haugsbakk's comments
>
> git-gui.sh | 30 +++++++-----------------------
> 1 file changed, 7 insertions(+), 23 deletions(-)
>
> diff --git a/git-gui.sh b/git-gui.sh
> index 4528b22..be0b8d9 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 [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} {
Thank you, that saves quite a few lines. A difference is that `nice` was
looked up only when needed and now it's on every startup. Personally, I
don't mind this change. It should not have a noticable effect on the
responsiveness.
Queued with an apostrophe in "let's".
-- Hannes
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] git-gui: simplify using nice(1)
2025-08-21 18:59 ` Johannes Sixt
@ 2025-08-21 19:19 ` Mark Levedahl
0 siblings, 0 replies; 5+ messages in thread
From: Mark Levedahl @ 2025-08-21 19:19 UTC (permalink / raw)
To: Johannes Sixt; +Cc: kristofferhaugsbakk, git
On 8/21/25 2:59 PM, Johannes Sixt wrote:
> Thank you, that saves quite a few lines. A difference is that `nice` was
> looked up only when needed and now it's on every startup. Personally, I
> don't mind this change. It should not have a noticable effect on the
> responsiveness.
>
> Queued with an apostrophe in "let's".
>
> -- Hannes
>
And, nice was always looked up on startup if a diff on anything was needed, or if running
git-blame was asked for, which for me means always so I see no difference in startup.
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-21 19:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20 15:24 [PATCH] git-gui: simplify using nice Mark Levedahl
2025-08-20 15:41 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox