aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2025-05-03 11:52:35 +0200
committerTaylor Blau <me@ttaylorr.com>2025-05-23 17:04:23 -0400
commit23ba43256b421c322af9b99150fb324575175bb0 (patch)
treea4508582e1103a60be1c426c5e88a983981fa8f3
parentgit-gui: sanitize 'exec' arguments: background (diff)
downloadgit-23ba43256b421c322af9b99150fb324575175bb0.tar.gz
git-23ba43256b421c322af9b99150fb324575175bb0.zip
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>
-rwxr-xr-xgit-gui.sh4
-rw-r--r--lib/checkout_op.tcl3
-rw-r--r--lib/choose_repository.tcl3
-rw-r--r--lib/console.tcl4
-rw-r--r--lib/merge.tcl2
5 files changed, 7 insertions, 9 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 6ecddfdd0a..890a172fc4 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -651,10 +651,6 @@ proc git_read {args} {
_lappend_nice opt
}
- --stderr {
- lappend args 2>@1
- }
-
default {
break
}
diff --git a/lib/checkout_op.tcl b/lib/checkout_op.tcl
index 5f7011078a..31992f461b 100644
--- a/lib/checkout_op.tcl
+++ b/lib/checkout_op.tcl
@@ -345,13 +345,14 @@ method _readtree {} {
[mc "Updating working directory to '%s'..." [_name $this]] \
[mc "files checked out"]]
- set fd [git_read --stderr read-tree \
+ set fd [git_read read-tree \
-m \
-u \
-v \
--exclude-per-directory=.gitignore \
$HEAD \
$new_hash \
+ 2>@1 \
]
fconfigure $fd -blocking 0 -translation binary
fileevent $fd readable [cb _readtree_wait $fd $status_bar_operation]
diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
index ef7ad7c175..7bd738e51e 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -953,12 +953,13 @@ method _do_clone_checkout {HEAD} {
[mc "files"]]
set readtree_err {}
- set fd [git_read --stderr read-tree \
+ set fd [git_read read-tree \
-m \
-u \
-v \
HEAD \
HEAD \
+ 2>@1 \
]
fconfigure $fd -blocking 0 -translation binary
fileevent $fd readable [cb _readtree_wait $fd]
diff --git a/lib/console.tcl b/lib/console.tcl
index bb6b9c889e..c7f20b87cb 100644
--- a/lib/console.tcl
+++ b/lib/console.tcl
@@ -91,10 +91,10 @@ method _init {} {
}
method exec {cmd {after {}}} {
+ lappend cmd 2>@1
if {[lindex $cmd 0] eq {git}} {
- set fd_f [eval git_read --stderr [lrange $cmd 1 end]]
+ set fd_f [eval git_read [lrange $cmd 1 end]]
} else {
- lappend cmd 2>@1
set fd_f [_open_stdout_stderr $cmd]
}
fconfigure $fd_f -blocking 0 -translation binary
diff --git a/lib/merge.tcl b/lib/merge.tcl
index 897dc2a286..e97c91eab6 100644
--- a/lib/merge.tcl
+++ b/lib/merge.tcl
@@ -239,7 +239,7 @@ Continue with resetting the current changes?"]
}
if {[ask_popup $op_question] eq {yes}} {
- set fd [git_read --stderr read-tree --reset -u -v HEAD]
+ set fd [git_read read-tree --reset -u -v HEAD 2>@1]
fconfigure $fd -blocking 0 -translation binary
set status_bar_operation [$::main_status \
start \