aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2025-05-04 15:39:03 +0200
committerTaylor Blau <me@ttaylorr.com>2025-05-23 17:04:24 -0400
commit60b0ba0a04c413b716dc33f83285ede26e820668 (patch)
tree163c7c42dc0e035dd72a9f9d41559982df3138e8 /lib
parent1e0a93c3d35c84547b21ba704a9c4383d4360140 (diff)
downloadgit-60b0ba0a04c413b716dc33f83285ede26e820668.tar.xz
git-gui: pass redirections as separate argument to git_read
We are going to treat command arguments and redirections differently to avoid passing arguments that look like redirections to the command accidentally. To do so, it will be necessary to know which arguments are intentional redirections. Rewrite direct call sites of git_read to pass intentional redirections as a second (optional) argument. git_read defers to safe_open_command, but we cannot make it safe, yet, because one of the callers of git_read is proc git, which does not yet know which of its arguments are redirections. This is the topic of the next commit. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/checkout_op.tcl4
-rw-r--r--lib/choose_repository.tcl4
-rw-r--r--lib/console.tcl3
-rw-r--r--lib/merge.tcl2
4 files changed, 6 insertions, 7 deletions
diff --git a/lib/checkout_op.tcl b/lib/checkout_op.tcl
index 48fd1a3cac..87ed0b4858 100644
--- a/lib/checkout_op.tcl
+++ b/lib/checkout_op.tcl
@@ -352,8 +352,8 @@ method _readtree {} {
--exclude-per-directory=.gitignore \
$HEAD \
$new_hash \
- 2>@1 \
- ]]
+ ] \
+ [list 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 7b64a11239..5b361cc424 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -959,8 +959,8 @@ method _do_clone_checkout {HEAD} {
-v \
HEAD \
HEAD \
- 2>@1 \
- ]]
+ ] \
+ [list 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 cc416d4811..4715ce91e6 100644
--- a/lib/console.tcl
+++ b/lib/console.tcl
@@ -92,8 +92,7 @@ method _init {} {
method exec {cmd {after {}}} {
if {[lindex $cmd 0] eq {git}} {
- lappend cmd 2>@1
- set fd_f [git_read [lrange $cmd 1 end]]
+ set fd_f [git_read [lrange $cmd 1 end] [list 2>@1]]
} else {
set fd_f [safe_open_command $cmd [list 2>@1]]
}
diff --git a/lib/merge.tcl b/lib/merge.tcl
index 6317c32127..55b4fc5ed3 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 [list read-tree --reset -u -v HEAD 2>@1]]
+ set fd [git_read [list read-tree --reset -u -v HEAD] [list 2>@1]]
fconfigure $fd -blocking 0 -translation binary
set status_bar_operation [$::main_status \
start \