]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: use git_read in githook_read
authorJohannes Sixt <j6t@kdbg.org>
Sat, 3 May 2025 17:21:53 +0000 (19:21 +0200)
committerTaylor Blau <me@ttaylorr.com>
Fri, 23 May 2025 21:04:23 +0000 (17:04 -0400)
0730a5a3a5e6 ("git-gui - use git-hook, honor core.hooksPath", 2023-09-17)
rewrote githook_read to use `git hook` to run a hook script. The code
that was replaced discovered the hook script file manually and invoked
it using function _open_stdout_stderr. After the rewrite, this function
is still invoked, but it calls into `git` instead of the hook scripts.

Notice though, that we have function git_read that invokes git and
prepares a pipe for the caller to read from. Replace the implementation
of githook_read to be just a wrapper around git_read. This unifies the
way in which the git executable is invoked. git_read ultimately also
calls into _open_stdout_stderr, but it modifies the path to the git
executable before doing so.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
git-gui.sh

index 28113220af8770686e16aad2c023383f698ef2d8..e10bf2a039295e31d205bf96dd921dfd9293c980 100755 (executable)
@@ -669,8 +669,7 @@ proc git_write {args} {
 }
 
 proc githook_read {hook_name args} {
-       set cmd [concat git hook run --ignore-missing $hook_name -- $args 2>@1]
-       return [_open_stdout_stderr $cmd]
+       git_read hook run --ignore-missing $hook_name -- $args 2>@1
 }
 
 proc kill_file_process {fd} {