Re: cherry-pick / pre-commit hook?
From: Dave Abrahams <hidden>
Date: 2016-06-15 22:50:18
At Wed, 8 Dec 2010 16:05:14 -0600, Jonathan Nieder wrote:
The main purpose of the pre-commit and commit-msg hooks is to avoid introducing regressions in whitespace style, encoding, and so forth; and it would make cherry-picking unnecessarily difficult, without preventing regressions, to unconditionally apply the same standards to existing code. For this reason, in v0.99.6~51 (2005-08-29), git learned to skip the usual hooks when cherry-picking or reverting an existing commit. But sometimes the checks are wanted anyway. For example, with this patch applied, you can safely fetch some new contributor's code: $ git cherry-pick -s --verify HEAD..FETCH_HEAD while allowing the pre-commit and commit-msg hooks to run their usual checks so the result can error out if the patches are not clean. Signed-off-by: Jonathan Nieder <redacted> --- Untested. Please feel free to add some documentation and tests and submit it for real if this looks like a good idea. :)
Well, thanks, but sadly I can only invest enough time to file this bug report right now: if you're going to have a "pre-commit hook" concept, but not run that hook for some kinds of commits, then that fact needs to be documented. -- Dave Abrahams BoostPro Computing http://www.boostpro.com