git-gui: remove option --stderr from git_read

Some callers of git_read want to redirect stderr of the invoked command to stdout. The function offers option --stderr for this purpose. However, the option only appends 2>@1 to the commands. The callers can do that themselves. In lib/console.tcl we even have a caller that already knew implictly what --stderr does behind the scenes. This is a preparation for a later change where we want to make git_read non-variadic. Then it cannot have optional leading arguments. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Taylor Blau <me@ttaylorr.com>

Johannes Sixt committed May 3, 2025 at 11:52 UTC 23ba43256b421c322af9b99150fb324575175bb0
5 files changed +7 -9
git-gui.sh
-4
@@ -651,10 +651,6 @@ proc git_read {args} {
651 _lappend_nice opt
652 }
653
654 - --stderr {
655 - lappend args 2>@1
656 - }
657 -
654 default {
655 break
656 }
lib/checkout_op.tcl
+2 -1
@@ -345,13 +345,14 @@ method _readtree {} {
345 [mc "Updating working directory to '%s'..." [_name $this]] \
346 [mc "files checked out"]]
347
348 - set fd [git_read --stderr read-tree \
348 + set fd [git_read read-tree \
349 -m \
350 -u \
351 -v \
352 --exclude-per-directory=.gitignore \
353 $HEAD \
354 $new_hash \
355 + 2>@1 \
356 ]
357 fconfigure $fd -blocking 0 -translation binary
358 fileevent $fd readable [cb _readtree_wait $fd $status_bar_operation]
lib/choose_repository.tcl
+2 -1
@@ -953,12 +953,13 @@ method _do_clone_checkout {HEAD} {
953 [mc "files"]]
954
955 set readtree_err {}
956 - set fd [git_read --stderr read-tree \
956 + set fd [git_read read-tree \
957 -m \
958 -u \
959 -v \
960 HEAD \
961 HEAD \
962 + 2>@1 \
963 ]
964 fconfigure $fd -blocking 0 -translation binary
965 fileevent $fd readable [cb _readtree_wait $fd]
lib/console.tcl
+2 -2
@@ -91,10 +91,10 @@ method _init {} {
91 }
92
93 method exec {cmd {after {}}} {
94 + lappend cmd 2>@1
95 if {[lindex $cmd 0] eq {git}} {
95 - set fd_f [eval git_read --stderr [lrange $cmd 1 end]]
96 + set fd_f [eval git_read [lrange $cmd 1 end]]
97 } else {
97 - lappend cmd 2>@1
98 set fd_f [_open_stdout_stderr $cmd]
99 }
100 fconfigure $fd_f -blocking 0 -translation binary
lib/merge.tcl
+1 -1
@@ -239,7 +239,7 @@ Continue with resetting the current changes?"]
239 }
240
241 if {[ask_popup $op_question] eq {yes}} {
242 - set fd [git_read --stderr read-tree --reset -u -v HEAD]
242 + set fd [git_read read-tree --reset -u -v HEAD 2>@1]
243 fconfigure $fd -blocking 0 -translation binary
244 set status_bar_operation [$::main_status \
245 start \