Re: [PATCH 0/3] pre-merge-hook
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 6, 2012, 05:07 UTC
- Message-ID
- <7v8vcn68o9.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <cover.1346851863.git.git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 9 quoted lines
> The pre-commit hook is often used to ensure certain properties of each > comitted tree like formatting or coding standards, validity (lint/make) > or code quality (make test). But merges introduce new commits unless > they are fast forwards, and therefore they can break these properties > because the pre-commit hook is not run by "git merge". > > Introduce a pre-merge hook which works for (non ff, automatic) merges > like pre-commit does for commits. Typically this will just call the > pre-commit hook (like in the sample hook), but it does not need to.
When your merge asks for a help from you to resolve conflict, you conclude with "git commit", and at that point, pre-commit hook will have a chance to reject it, presumably. That means for any project that wants to audit a merge via hook, their pre-commit hook MUST be prepared to look at and judge a merge. Given that, is a separate hook that "can just call the pre-commit but does not need to" really needed and useful?
I admit that I haven't thought things through, but adding a boolean "merge.usePreCommitHook" smells like a more appropriate approach to me.
I dunno.