Re: [PATCH 0/5] Multiple hook support
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Apr 24, 2019, 02:22 UTC
- Message-ID
- <20190424022240.GH6316@genre.crustytoothpaste.net>
- In-Reply-To
- <xmqqtveo2lyx.fsf@gitster-ct.c.googlers.com>
On Wed, Apr 24, 2019 at 11:09:10AM +0900, Junio C Hamano wrote:
Show 14 quoted lines
> "brian m. carlson" <sandals@crustytoothpaste.net> writes: > > > To preserve backwards compatibility, we don't run the hooks in the ".d" > > directory if the single file is a valid hook (i.e. it exists and is > > executable). This is because some people already have multiple hook > > scripts configured, and if we ran them both, we'd run the hooks twice. > > This would be bad for e.g. the prepare-commit-msg hook. This is also the > > least surprising behavior. > > OK. An obvious alternative may be to see if the expected hooks path > is a directory and use the contents. If ".git/hooks/pre-commit" is > a single file, we know it is the single hook as before, and if it is > a directory, we know that is not a custom made (i.e. from the world > before this series supported in the core-git) multi-hook setup.
That's an idea I hadn't considered. I'm interested to hear other folks' ideas on it, but that certainly avoids a lot of the problems in my approach.
Show 7 quoted lines
> > We check each hook for its exit status, even if the hook normally > > ignores exit status, and if it fails, we abort executing further hooks. > > This part may become the most controversial in the whole topic, but > a design discussion is helped by having a concrete proposal that > makes its own design decision, and this is the simplest design of > the failure case that is the easiest to understand.
I expected it might be. I'm not strongly wedded to it, so if people make a good argument for something else, I'm okay with changing it.
-- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204