aboutsummaryrefslogtreecommitdiff
path: root/git-gui.sh
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 /git-gui.sh
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 'git-gui.sh')
-rwxr-xr-xgit-gui.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 408149b530..bbdbd35d26 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -642,11 +642,11 @@ proc safe_open_command {cmd {redir {}}} {
return $fd
}
-proc git_read {cmd} {
+proc git_read {cmd {redir {}}} {
set cmdp [_git_cmd [lindex $cmd 0]]
set cmd [lrange $cmd 1 end]
- return [safe_open_command [concat $cmdp $cmd]]
+ return [safe_open_command [concat $cmdp $cmd] $redir]
}
proc git_read_nice {cmd} {
@@ -669,7 +669,7 @@ proc git_write {cmd} {
}
proc githook_read {hook_name args} {
- git_read [concat [list hook run --ignore-missing $hook_name --] $args 2>@1]
+ git_read [concat [list hook run --ignore-missing $hook_name --] $args] [list 2>@1]
}
proc kill_file_process {fd} {