New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should `revertPattern` in angular preset also match regular revert format? #348

Open
pvdlg opened this Issue Jul 8, 2018 · 0 comments

Comments

1 participant
@pvdlg
Copy link

pvdlg commented Jul 8, 2018

The default revertPattern is

/^Revert\s"([\s\S]*)"\s*This reverts commit (\w*)\./

and the one in conventional-changelog-angular is

/^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./

The Commit Message Guidelines mention:

If the commit reverts a previous commit, it should begin with revert:, followed by the header of the reverted commit. In the body it should say: This reverts commit ., where the hash is the SHA of the commit being reverted. A commit with this format is automatically created by the git revert command.

So conventional-changelog-angular behave as specified, however the statement A commit with this format is automatically created by the git revert command seems to be incorrect:

$ git commit -m "feat: some feature"
[master 5e817ec] feat: some feature

$ git revert 5e817ec                                                                                                                                                              
[master 3881a12] Revert "feat: some feature"

$ git log -n 1 --pretty='%B'                                                                                                                                                       
Revert "feat: some feature"

This reverts commit 5e817ec4022b7ea1406ad9864e8e124fe94be23e.

As a result when using the conventional-changelog-angular and reverting a commit with git revert (without later editing the commit message manually) it will not be parsed properly.

To solve this problem we could change revertPattern in the conventional-changelog-angular to

/^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./

so both format would be matched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment