Skip to content

Commit

Permalink
hooks: allow input from stdin
Browse files Browse the repository at this point in the history
Let hooks receive user input if applicable.

Closing stdin originates in f5bbc32 (Port git commit to C,
2007). Looks like the original shell implementation did have
stdin open. Not clear why the author chose to close it on
the C port (maybe copy&paste).

Some references of users requesting this feature. Some of
them use acrobatics to gain access to stdin:
[1] https://stackoverflow.com/q/1067874/764870
[2] https://stackoverflow.com/q/47477766/764870
[3] https://stackoverflow.com/q/3417896/764870
[4] PHP-CS-Fixer/PHP-CS-Fixer#3165
[5] typicode/husky#442
  • Loading branch information
orgads committed Nov 17, 2020
1 parent e31aba4 commit 25068c2
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion run-command.c
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,6 @@ int run_hook_ve(const char *const *env, const char *name, va_list args)
while ((p = va_arg(args, const char *)))
strvec_push(&hook.args, p);
hook.env = env;
hook.no_stdin = 1;
hook.stdout_to_stderr = 1;
hook.trace2_hook_name = name;

Expand Down

0 comments on commit 25068c2

Please sign in to comment.