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
This commit is contained in:
George Kalpakas
2019-08-06 20:24:10 +03:00
committed by Kara Erickson
parent 2b289250d8
commit c0d5684078
3 changed files with 49 additions and 7 deletions

View File

@ -45,7 +45,9 @@ module.exports = (gulp) => () => {
console.log(`There are zero new commits between ${baseBranch} and HEAD`);
}
const someCommitsInvalid = !commitsByLine.every(validateCommitMessage);
const disallowSquashCommits = true;
const someCommitsInvalid =
!commitsByLine.every(m => validateCommitMessage(m, disallowSquashCommits));
if (someCommitsInvalid) {
throw new Error(