diff options
| author | Johannes Sixt <j6t@kdbg.org> | 2025-05-03 13:11:21 +0200 |
|---|---|---|
| committer | Taylor Blau <me@ttaylorr.com> | 2025-05-23 17:04:23 -0400 |
| commit | aa42e87ef4ee9d84bd2fdb5e56de2ac2b61575d9 (patch) | |
| tree | 62b65e65745bbdb838eb08279d9b7d7db9b0e4ea /git-gui.sh | |
| parent | 23ba43256b421c322af9b99150fb324575175bb0 (diff) | |
| download | git-aa42e87ef4ee9d84bd2fdb5e56de2ac2b61575d9.tar.gz | |
git-gui: break out a separate function git_read_nice
There are two callers of git_read that request special treatment using
option --nice. Rewrite them to call a new function git_read_nice that
does the special treatment. Now we can remove all option treatment from
git_read.
git_write has the same capability, but there are no callers that
request --nice. Remove the feature without substitution.
This is a preparation for a later change where we want to make git_read
and friends non-variadic. Then it cannot have optional arguments.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'git-gui.sh')
| -rwxr-xr-x | git-gui.sh | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/git-gui.sh b/git-gui.sh index 890a172fc4..28113220af 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -643,22 +643,16 @@ proc _open_stdout_stderr {cmd} { } proc git_read {args} { - set opt [list] - - while {1} { - switch -- [lindex $args 0] { - --nice { - _lappend_nice opt - } + set cmdp [_git_cmd [lindex $args 0]] + set args [lrange $args 1 end] - default { - break - } + return [_open_stdout_stderr [concat $cmdp $args]] +} - } +proc git_read_nice {args} { + set opt [list] - set args [lrange $args 1 end] - } + _lappend_nice opt set cmdp [_git_cmd [lindex $args 0]] set args [lrange $args 1 end] @@ -667,28 +661,11 @@ proc git_read {args} { } proc git_write {args} { - set opt [list] - - while {1} { - switch -- [lindex $args 0] { - --nice { - _lappend_nice opt - } - - default { - break - } - - } - - set args [lrange $args 1 end] - } - set cmdp [_git_cmd [lindex $args 0]] set args [lrange $args 1 end] - _trace_exec [concat $opt $cmdp $args] - return [open [concat [list | ] $opt $cmdp $args] w] + _trace_exec [concat $cmdp $args] + return [open [concat [list | ] $cmdp $args] w] } proc githook_read {hook_name args} { |
