Re: [PATCH 5/5] hook: support a --to-stdin=<path> option for testing
On 2023-01-23 19:55, Junio C Hamano wrote:
Show 10 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> From: Emily Shaffer <emilyshaffer@google.com>
>>
>> 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?
Yes I would be trying to use it for my send-email header patch right away.
Show 16 quoted lines
>
> 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.