conventional-changelog-archived-repos / validate-commit-msg

DEPRECATED. Use https://github.com/marionebl/commitlint instead. githook to validate commit messages are up to standard
http://conventionalcommits.org/
MIT License
556 stars 101 forks source link

Merge commit pattern broken #35

Closed opatut closed 8 years ago

opatut commented 8 years ago

My git generates the following message:

Merge remote-tracking branch 'origin/master' into feature/foobar

This does not fit the current pattern /^Merge branch \'.*\' .*$/. Can we change it to /^Merge (remote-tracking )?branch \'.*\' .*$/ or even /^Merge.*branch \'.*\' .*$/?

opatut commented 8 years ago

After a bit of research, it seems not even the "branch" substring must be present in the git generated message. Only the /^Merge/ is hard-coded into git-fmt-merge-msg, see fmt-merge-msg.c:418.

Hence, the regex might need to be very permissive in order to prevent false negatives. Though I expect people will sometimes start their message with "Merge " manually, even if it is not a merge commit. Do you prefer false postives or false negatives? ;)

We could consider a configuration option, e.g.:

"mergeRegex": "permissive|restrictive|<regex>",