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 6788d86709 build: fix `validate-commit-message` on Windows (#28780)
Previously, the `validate-commit-message` gulp task was using the
`git log ... ^r1 r2` syntax to list commits between the base branch and
the current head. This didn't work as expected on Windows, because `^`
is the escape character. As a result, the command was equivalent to
`git log ... r1 r2` on Windows, which essentially logs all commits
reachable from either `r1` or `r2`.

This commit fixes it by switching to git's
[double-dot range notation][1] (`r1..r2`), which is an alias for the
`^r1 r2` syntax and works correctly on all platforms.

[1]: https://git-scm.com/docs/gitrevisions#_dotted_range_notations

Fixes #16830

PR Close #28780
2019-02-19 12:37:57 -08:00
George Kalpakas ababc5b4a4 build: stop execution on error in `validate-commit-message` (#28780)
Stop execution when an error happens in `validate-commit-message` gulp
task and ensure the error message is printed at the bottom.

Fixes #16829

PR Close #28780
2019-02-19 12:37:56 -08:00
Peter Bacon Darwin d75a9fabdc ci: validate commit messages correctly when not on master (#19685)
PR Close #19685
2017-10-17 10:38:29 -07:00
Olivier Combe 0f5c70d563 build: update npm dependencies (#19328)
PR Close #19328
2017-09-22 13:20:52 -07:00
Igor Minar b1a79fd2ec ci: simplify validate-commit-message empty line logic 2017-02-16 14:57:23 -08:00
Misko Hevery d3f174a57f ci: fix validate-commit-messages 2017-02-10 20:57:33 -08:00
Pete Bacon Darwin 0ba5bebf61 build: modularize the gulp file to be easier to maintain (#14259)
This is a precursor to bringing in some of the gulp tasks from angular.io,
which could lead to the gulpfile becoming unwieldy.
2017-02-03 00:10:41 -08:00