Redirect update hook stdout to stderr.
If an update hook outputs to stdout then that output will be sent back over the wire to the push client as though it were part of the git protocol. This tends to cause protocol errors on the client end of the connection, as the hook output is not expected in that context. Most hook developers work around this by making sure their hook outputs everything to stderr. But hooks shouldn't need to perform such special behavior. Instead we can just dup stderr to stdout prior to invoking the update hook. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:

committed by
Junio C Hamano

parent
9b0b50936e
commit
cd83c74cb3
@ -73,7 +73,8 @@ static int run_update_hook(const char *refname,
|
||||
|
||||
if (access(update_hook, X_OK) < 0)
|
||||
return 0;
|
||||
code = run_command(update_hook, refname, old_hex, new_hex, NULL);
|
||||
code = run_command_opt(RUN_COMMAND_STDOUT_TO_STDERR,
|
||||
update_hook, refname, old_hex, new_hex, NULL);
|
||||
switch (code) {
|
||||
case 0:
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user