Re: [PATCH 1/4] git-merge: Honor pre-merge hook
- From
- Martin Ågren <martin.agren@gmail.com>
- Date
- Sep 23, 2017, 00:04 UTC
- Message-ID
- <CAN0heSo5AE=Z2yoZmtcvnPc_7h3wWn4yMrzB7kDXPyhB_CsLQw@mail.gmail.com>
- In-Reply-To
- <053ce92e978aff511667669682c9a71830008605.1506081120.git.git@grubix.eu>
On 22 September 2017 at 14:04, Michael J Gruber <git@grubix.eu> wrote:
Show 10 quoted lines
> From: Michael J Gruber <git@drmicha.warpmail.net> > > git-merge does not honor the pre-commit hook when doing automatic merge > commits, and for compatibility reasons this is going to stay. > > Introduce a pre-merge hook which is called for an automatic merge commit > just like pre-commit is called for a non-automatic merge commit (or any > other commit). > > Signed-off-by: Michael J Gruber <git@grubix.eu>
[...]
Show 19 quoted lines
> diff --git a/templates/hooks--pre-merge.sample b/templates/hooks--pre-merge.sample > new file mode 100755 > index 0000000000..a6313e6d5c > --- /dev/null > +++ b/templates/hooks--pre-merge.sample > @@ -0,0 +1,13 @@ > +#!/bin/sh > +# > +# An example hook script to verify what is about to be committed. > +# Called by "git merge" with no arguments. The hook should > +# exit with non-zero status after issuing an appropriate message if > +# it wants to stop the commit. > +# > +# To enable this hook, rename this file to "pre-merge". > + > +. git-sh-setup > +test -x "$GIT_DIR/hooks/pre-commit" && > + exec "$GIT_DIR/hooks/pre-commit" > +:
Won't this always exit successfully? Is that wanted? If this sample hook is activated but can't find an executable pre-commit hook to call out to, should it complain in some helpful way rather than exiting silently (whether successfully or not)?
Martin