Commitlint: @commitlint/config-conventional rejects default merge commit messages

Created on 6 Jun 2018  Â·  7Comments  Â·  Source: conventional-changelog/commitlint

I'm surprised no one has run across this, but I think it only happens after there are merge conflicts, because if there are no conflicts in the merge I think git automatically commits without running the commit message hook.

Expected Behavior


When I have merge conflicts, fix them, and then try to commit, commitlint should accept the auto-generated merge commit message.

Current Behavior


commitlint rejects the auto-generated merge commit message:

â§—   input: Merge branch 'master' of https://github.com/jcoreio/webapp-apollo
✖   message may not be empty [subject-empty]
✖   type may not be empty [type-empty]
✖   found 2 problems, 0 warnings

Affected packages

  • [ ] cli
  • [x] core
  • [ ] prompt
  • [ ] config-angular
  • [x] config-conventional?

Possible Solution


Steps to Reproduce (for bugs)


  1. Edit any file in a project using @commitlint/config-conventional
  2. Try to commit with a fake merge commit message: git commit -m "Merge branch 'master' of https://github.com/commitlint/cli"

Context


Your Environment

| Executable | Version |
| ---: | :--- |
| commitlint --version | 5.2.8 |
| git --version | 2.15.1 (Apple Git-101) |
| node --version | v8.9.2 |

Most helpful comment

@byCedric I created a PR. With the modifications of #439 it is still not working. You can see an example which does not work in my PR. Let's discuss it :)

My PR: #454

All 7 comments

Currently only Merged is listed in the ignore list, you can see all patterns over here. May I ask what Git provider you are using which uses the Merge notation instead of Merged? Maybe it's a good idea to add the Merge version too.

I'm a little confused, I'm using the git cli on macOS. This merge was a result of git pull skeleton master, maybe some git commands cause different commit wording?

@jedwards1211 My bad, I didn't mean to confuse you! I mistook this bug report as a feature request. As far as I can tell, you are using an old version of commitlint. In the latest version (7.0.0) this message is ignored by the @commitlint/is-ignored package. Could you try upgrading to this version?

Thanks for reporting @jedwards1211 and triage @byCedric!
Closing this as I am very confident this is fixed in recent commitlint versions as mentioned by @byCedric here: https://github.com/marionebl/commitlint/issues/365#issuecomment-403802596

Guys it is still not working. The regexp is not correct..

@dabit1gamma could you provide some examples where the regular expression fails for you? I think we have modified it a bit more in #439. But if you could provide some cases where the current expression is not working for you, that will be helpful. 😄

@byCedric I created a PR. With the modifications of #439 it is still not working. You can see an example which does not work in my PR. Let's discuss it :)

My PR: #454

Was this page helpful?
0 / 5 - 0 ratings