{"thread":{"id":"63996","subject":"[PATCH] git-gui: simplify using nice","startedAt":"2025-08-20T15:25:13Z","lastAt":"2025-08-21T19:19:31Z","messageCount":5,"participants":["Mark Levedahl","Kristoffer Haugsbakk","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"524531","messageId":"20250820152451.20872-1-mlevedahl@gmail.com","threadId":"63996","inReplyTo":null,"subject":"[PATCH] git-gui: simplify using nice","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2025-08-20T15:24:51Z","receivedAt":"2025-08-20T15:25:13Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"git-gui invokes some long running commands using \"nice git $cmd\" if nice\nis found and works, otherwise just \"git $cmd\".  The current code is more\ncomplex than needed, lets simplify it.\n\nSigned-off-by: Mark Levedahl <mlevedahl@gmail.com>\n---\n git-gui.sh | 30 +++++++-----------------------\n 1 file changed, 7 insertions(+), 23 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 4528b22..5ee08d5 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -578,21 +578,6 @@ proc open_cmd_pipe {cmd path} {\n \treturn [open |$run r]\n }\n \n-proc _lappend_nice {cmd_var} {\n-\tglobal _nice\n-\tupvar $cmd_var cmd\n-\n-\tif {![info exists _nice]} {\n-\t\tset _nice [_which nice]\n-\t\tif {[catch {safe_exec [list $_nice git version]}]} {\n-\t\t\tset _nice {}\n-\t\t}\n-\t}\n-\tif {$_nice ne {}} {\n-\t\tlappend cmd $_nice\n-\t}\n-}\n-\n proc git {args} {\n \tgit_redir $args {}\n }\n@@ -626,15 +611,14 @@ proc git_read {cmd {redir {}}} {\n \treturn [safe_open_command $cmdp $redir]\n }\n \n-proc git_read_nice {cmd} {\n-\tglobal _git\n-\tset opt [list]\n-\n-\t_lappend_nice opt\n-\n-\tset cmdp [concat [list $_git] $cmd]\n+set _nice [_which nice]\n+if {[catch {safe_exec [list $_nice git version]}]} {\n+\tset _nice {}\n+}\n \n-\treturn [safe_open_command [concat $opt $cmdp]]\n+proc git_read_nice {cmd} {\n+\tset cmdp [list {*}$::_nice $::_git {*}$cmd]\n+\treturn [safe_open_command $cmdp]\n }\n \n proc git_write {cmd} {\n-- \n2.51.0.99.15\n\n"},{"id":"524534","messageId":"61c4ba41-9ef1-41a8-ac5f-a334dd951add@app.fastmail.com","threadId":"63996","inReplyTo":"20250820152451.20872-1-mlevedahl@gmail.com","subject":"Re: [PATCH] git-gui: simplify using nice","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2025-08-20T15:41:31Z","receivedAt":"2025-08-20T15:41:53Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"> Re: [PATCH] git-gui: simplify using nice\n\ns/using nice/using nice(1)/ ?\n\nOn Wed, Aug 20, 2025, at 17:24, Mark Levedahl wrote:\n> git-gui invokes some long running commands using \"nice git $cmd\" if nice\n> is found and works, otherwise just \"git $cmd\".  The current code is more\n> complex than needed, lets simplify it.\n\ns/, lets simplify it/; let's simplify it/\n\n>\n> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>\n\n-- \nKristoffer Haugsbakk\n"},{"id":"524536","messageId":"20250820165021.24604-1-mlevedahl@gmail.com","threadId":"63996","inReplyTo":"20250820152451.20872-1-mlevedahl@gmail.com","subject":"[PATCH v2] git-gui: simplify using nice(1)","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2025-08-20T16:50:21Z","receivedAt":"2025-08-20T16:50:38Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"git-gui invokes some long running commands using \"nice git $cmd\" if nice\nis found and works, otherwise just \"git $cmd\".  The current code is more\ncomplex than needed; lets simplify it.\n\nSigned-off-by: Mark Levedahl <mlevedahl@gmail.com>\n---\nupdates from v1:\n- _which does not return a list, _nice must be a list to handle path\n  with spaces  (should have been in v1, was in another patch - oops)\n- Address Kristoffer Haugsbakk's comments\n\n git-gui.sh | 30 +++++++-----------------------\n 1 file changed, 7 insertions(+), 23 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 4528b22..be0b8d9 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -578,21 +578,6 @@ proc open_cmd_pipe {cmd path} {\n \treturn [open |$run r]\n }\n \n-proc _lappend_nice {cmd_var} {\n-\tglobal _nice\n-\tupvar $cmd_var cmd\n-\n-\tif {![info exists _nice]} {\n-\t\tset _nice [_which nice]\n-\t\tif {[catch {safe_exec [list $_nice git version]}]} {\n-\t\t\tset _nice {}\n-\t\t}\n-\t}\n-\tif {$_nice ne {}} {\n-\t\tlappend cmd $_nice\n-\t}\n-}\n-\n proc git {args} {\n \tgit_redir $args {}\n }\n@@ -626,15 +611,14 @@ proc git_read {cmd {redir {}}} {\n \treturn [safe_open_command $cmdp $redir]\n }\n \n-proc git_read_nice {cmd} {\n-\tglobal _git\n-\tset opt [list]\n-\n-\t_lappend_nice opt\n-\n-\tset cmdp [concat [list $_git] $cmd]\n+set _nice [list [_which nice]]\n+if {[catch {safe_exec [list {*}$_nice git version]}]} {\n+\tset _nice {}\n+}\n \n-\treturn [safe_open_command [concat $opt $cmdp]]\n+proc git_read_nice {cmd} {\n+\tset cmdp [list {*}$::_nice $::_git {*}$cmd]\n+\treturn [safe_open_command $cmdp]\n }\n \n proc git_write {cmd} {\n-- \n2.51.0.99.15\n\n"},{"id":"524676","messageId":"27f95ac2-380c-4334-8783-4b3b9ce38e24@kdbg.org","threadId":"63996","inReplyTo":"20250820165021.24604-1-mlevedahl@gmail.com","subject":"Re: [PATCH v2] git-gui: simplify using nice(1)","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2025-08-21T18:59:43Z","receivedAt":"2025-08-21T18:59:52Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 20.08.25 um 18:50 schrieb Mark Levedahl:\n> git-gui invokes some long running commands using \"nice git $cmd\" if nice\n> is found and works, otherwise just \"git $cmd\".  The current code is more\n> complex than needed; lets simplify it.\n> \n> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>\n> ---\n> updates from v1:\n> - _which does not return a list, _nice must be a list to handle path\n>   with spaces  (should have been in v1, was in another patch - oops)\n> - Address Kristoffer Haugsbakk's comments\n> \n>  git-gui.sh | 30 +++++++-----------------------\n>  1 file changed, 7 insertions(+), 23 deletions(-)\n> \n> diff --git a/git-gui.sh b/git-gui.sh\n> index 4528b22..be0b8d9 100755\n> --- a/git-gui.sh\n> +++ b/git-gui.sh\n> @@ -578,21 +578,6 @@ proc open_cmd_pipe {cmd path} {\n>  \treturn [open |$run r]\n>  }\n>  \n> -proc _lappend_nice {cmd_var} {\n> -\tglobal _nice\n> -\tupvar $cmd_var cmd\n> -\n> -\tif {![info exists _nice]} {\n> -\t\tset _nice [_which nice]\n> -\t\tif {[catch {safe_exec [list $_nice git version]}]} {\n> -\t\t\tset _nice {}\n> -\t\t}\n> -\t}\n> -\tif {$_nice ne {}} {\n> -\t\tlappend cmd $_nice\n> -\t}\n> -}\n> -\n>  proc git {args} {\n>  \tgit_redir $args {}\n>  }\n> @@ -626,15 +611,14 @@ proc git_read {cmd {redir {}}} {\n>  \treturn [safe_open_command $cmdp $redir]\n>  }\n>  \n> -proc git_read_nice {cmd} {\n> -\tglobal _git\n> -\tset opt [list]\n> -\n> -\t_lappend_nice opt\n> -\n> -\tset cmdp [concat [list $_git] $cmd]\n> +set _nice [list [_which nice]]\n> +if {[catch {safe_exec [list {*}$_nice git version]}]} {\n> +\tset _nice {}\n> +}\n>  \n> -\treturn [safe_open_command [concat $opt $cmdp]]\n> +proc git_read_nice {cmd} {\n> +\tset cmdp [list {*}$::_nice $::_git {*}$cmd]\n> +\treturn [safe_open_command $cmdp]\n>  }\n>  \n>  proc git_write {cmd} {\n\nThank you, that saves quite a few lines. A difference is that `nice` was\nlooked up only when needed and now it's on every startup. Personally, I\ndon't mind this change. It should not have a noticable effect on the\nresponsiveness.\n\nQueued with an apostrophe in \"let's\".\n\n-- Hannes\n\n"},{"id":"524677","messageId":"e3e52b89-8f4a-4efd-a29f-3967d52440ef@gmail.com","threadId":"63996","inReplyTo":"27f95ac2-380c-4334-8783-4b3b9ce38e24@kdbg.org","subject":"Re: [PATCH v2] git-gui: simplify using nice(1)","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2025-08-21T19:19:28Z","receivedAt":"2025-08-21T19:19:31Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"\nOn 8/21/25 2:59 PM, Johannes Sixt wrote:\n> Thank you, that saves quite a few lines. A difference is that `nice` was\n> looked up only when needed and now it's on every startup. Personally, I\n> don't mind this change. It should not have a noticable effect on the\n> responsiveness.\n>\n> Queued with an apostrophe in \"let's\".\n>\n> -- Hannes\n>\nAnd, nice was always looked up on startup if a diff on anything was needed, or if running\ngit-blame was asked for, which for me means always so I see no difference in startup.\n\nMark\n"}]}