Commit Graph

9 Commits

Author SHA1 Message Date
George Kalpakas 3df54be9e4 build: ensure fixup commits match an earlier, unmerged commit (#32023)
Previously, `validate-commit-message` would treat `fixup! `-prefixed
commits like this:
- It would strip the `fixup! ` prefix.
- It would validate the rest of the commit message header as any other
  commit.

However, fixup commits are special in that they need to exactly match an
earlier commit message header (sans the `fixup! ` prefix) in order for
git to treat them correctly. Otherwise, they will not be squashed into
the original commits and will be merged as is. Fixup commits can end up
not matching their original commit for several reasons (e.g. accidental
typo, changing the original commit message, etc.).

This commit prevents invalid fixup commits to pass validation by
ensuring that they match an earlier (unmerged) commit (i.e. a commit
between the current HEAD and the BASE commit).

NOTE: This new behavior is currently not activated in the pre-commit git
      hook, that is used to validate commit messages (because the
      preceding, unmerged commits are not available there). It _is_
      activated in `gulp validate-commit-message`, which is run as part
      of the `lint` job on CI and thus will detect invalid commits,
      before their getting merged.

PR Close #32023
2019-08-09 15:12:38 -07:00
George Kalpakas c0d5684078 fix: do not allow `squash! ` commits when merging (#32023)
While `fixup! ` is fine, `squash! ` means that the commit message needs
tweaking, which cannot be done automatically during merging (i.e. it
should be done by the PR author).

Previously, `validate-commit-message` would always allow
`squash! `-prefixed commits, which would cause problems during merging.

This commit changes `validate-commit-message` to make it configurable
whether such commits are allowed and configures the
`gulp validate-commit-message` task, which is run as part of the `lint`
job on CI, to not allow them.

NOTE: This new check is disabled in the pre-commit git hook that is used
      to validate commit messages, because these commits might still be
      useful during development.

PR Close #32023
2019-08-09 15:12:37 -07:00
George Kalpakas 2b289250d8 refactor: clean up `validate-commit-message` script (#32023)
This sets the ground for adding stricter rules for fixup commits in a
follow-up PR.

PR Close #32023
2019-08-09 15:12:37 -07:00
Victor Berchet a35bf114eb build: make commit validation accept typical Revert messages (#23480)
fixes #23479

PR Close #23480
2018-04-22 11:49:49 -07:00
Victor Berchet 435f6eecd2 build: make git revert messages valid (#22339)
`git revert` default message is "Revert <original message>" (no semi-colon)

PR Close #22339
2018-02-21 11:05:35 -08:00
Miško Hevery 5713faa667 build: autosquashes SHAs as part of merge-pr script (#21791)
To support `git checkin --fixup` and `git checkin —squash`
we need to make sure that `merge-pr` squashes the sepecial
commits before they are merged.

For more details see:
https://robots.thoughtbot.com/autosquashing-git-commits

PR Close #21791
2018-01-25 22:12:11 -08:00
Miško Hevery a33ff2c68f docs(ivy): add Ivy as a recognized label (#21428)
PR Close #21428
2018-01-10 15:31:54 -08:00
Alex Rickabaugh f20d1a8af5 ci: add @license to tools/validate-commit-message 2017-01-23 13:03:40 -08:00
Igor Minar dff6ee3272 ci: validate the message of each new commit as part of the CI linting
This patch adds the gulp command of `validate-commit-messages`
which will validate the range of commits messages present in the
active branch.

This check now runs on CI as part of the linting checks.

Allowed commit message types and scopes are controlled via commit-message.json file
and documented at https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines

This solution is based on old Vojta's code that he wrote for angular/angular.js, that was later adjusted
by @matsko in #13815.

Ideally we should switch over to something like https://www.npmjs.com/package/commitplease
as suggested in #9953 but that package currently doesn't support strict scope checking,
which is one of the primarily goal of this PR.

Note that this PR removes support for "chore" which was previously overused
by everyone on the team.

Closes #13815
Fixes #3337
2017-01-23 10:51:28 -08:00