angular-cn/tools/validate-commit-message
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
..
BUILD.bazel ci: remove validate-commit-message tests from travis (#27386) 2018-12-05 20:55:32 -08:00
commit-message.json build: allow "zone.js" as scope for commit messages (#31277) 2019-06-26 09:23:02 -07:00
index.js ci: add @license to tools/validate-commit-message 2017-01-23 13:03:40 -08:00
validate-commit-message.js build: ensure fixup commits match an earlier, unmerged commit (#32023) 2019-08-09 15:12:38 -07:00
validate-commit-message.spec.js build: ensure fixup commits match an earlier, unmerged commit (#32023) 2019-08-09 15:12:38 -07:00