Closed boudekerk closed 7 years ago
I'm not sure I understood you completely... What is this "title-match" you mentioned? The "githooks.checklog.match" doesn't exist... Do you mean "githooks.checklog.matchlog", instead?
I understood that you don't want to enforce the "title-required" option and that you want to look for JIRAs just on the commit message's first line, right?
I think you can accomplish this with the following configuration:
[githooks "checklog"]
title-required = 0
[githooks "checkjira"]
matchlog = ^([^\n]+)
The matchlog regex captures the commit message's first line.
Does it work for you?
Thanks! I didn't realise it was evaluated as a multi line regex, should have checked that of course. Sorry for bothering you.
Just to clarify I meant the title-match option of the CheckLog plugin, as I thought we needed this to achieve our goal. I guess we simply don't need the CheckLog plugin.
I still think there might be a nice improvement here, as with an optional title you might want to check the message, but only if there's no title to check. Perhaps nicer would be an option to just check the message as a whole without splitting it up in separate blocks to check individually. But as that's not something we need right now I'm closing this issue.
Thanks again!
We have a policy where we require a valid JIRA issue on the first line. Unfortunately we're currently unable to enforce this. We would like way to match against the first line of the commit message, whether this is the title or part of the body.
It's currently possible to use title-match with an optional title (githooks.checklog.title-required 0), but additionally enabling githooks.checklog.match is not possible as it: a] always match the message body, whether a title was present or not b] is applied to the whole message, not just the first line (which can't be matched by regex either AFAIK)
Would it be possible to introduce something like the following:
githooks.checklog.title-strict [01] This option, which is 1 by default, requires the title to be separated from the body by one empty line. If you set this to 0 the first line will always be treated as the title.
Thanks for considering.