Subject: Re: [PATCH 5/5] hook: support a --to-stdin=<path> option for testing

From: Junio C Hamano <[email-masked]>
Date: Mon, 23 Jan 2023 16:55:37 -0800

Ævar Arnfjörð Bjarmason  <[email-masked]> writes:

> From: Emily Shaffer <[email-masked]>
>
> Expose the "path_to_stdin" API added in the preceding commit in the
> "git hook run" command. For now we won't be using this command
> interface outside of the tests, but exposing this functionality makes
> it easier to test the hook API.

Presumably, the send-email validation topic would be using this
immediately once it becomes available, no?

When "git hook" finds and runs more than one hook script, do they
get the same input?  What I am wondering is if "to-stdin" should be
exposed like this interface (which may be sufficient for testing
purposes).  I imagine that scripters (e.g. send-email developers)
would find it more convenient if they do not have to come up with a
temporary file and they can just run "git hook" and feed whatever
they want to give to the hook from its standard input.  "git hook"
command, upon startup, should do the reading of its standard input
and spooling it to a temporary file it uses to pass the contents to
the hook scripts, in other words.

Other than that, it surely looks not just handy for tests, but has
immediate uses.

Thanks.