Re: [PATCH v4 1/2] hooks: allow input from stdin for commit-related hooks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 19, 2020 at 3:57 PM Orgad Shaneh via GitGitGadget
<gitgitgadget@xxxxxxxxx> wrote:
> Let hooks receive user input if applicable.
> [...]
> This allows for example prompting the user to choose an issue
> in prepare-commit-msg, and add "Fixes #123" to the commit message.
>
> Another possible use-case is running sanity test on pre-commit,
> and having a prompt like "This and that issue were found in your
> changes. Are you sure you want to commit? [Y/N]".

These use-cases really help readers understand the motivation for this
change. Good.

> Allow stdin only for commit-related hooks. Some of the other
> hooks pass their own input to the hook, so don't change them.
>
> Note: If pre-commit reads from stdin, and git commit is executed
> with -F - (read message from stdin), the message is not read
> correctly. This is fixed in the follow-up commit.

Rather than making such a fundamental change and having to deal with
the fallout by introducing complexity to handle various special-cases
which pop up now and in the future, I wonder if it makes more sense to
instead just update documentation to tell hook authors to read
explicitly from the console rather than expecting stdin to be
available (since stdin may already be consumed for other purposes when
dealing with hooks or commands which invoke the hooks).



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux