Skip to content

Commit 60f0ca0

Browse files
vsavkinhansl
authored andcommitted
fix(@angular/cli): fix the test-commit-message script to work with other target branches
1 parent 857bc0b commit 60f0ca0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scripts/test-commit-messages.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ logger
3131
process.exit(1);
3232
});
3333

34-
// Note: This is based on the gulp task found in the angular/angular repository
35-
execSync('git fetch origin');
36-
// Travis doesn't have master when running jobs on other branches (minor/patch/etc).
37-
execSync('git fetch origin master:master');
38-
3934
// Get PR target branch, default to master for running locally.
4035
const currentBranch = process.env.TRAVIS_BRANCH
4136
|| process.env.APPVEYOR_REPO_BRANCH
4237
|| 'master';
4338

39+
// Note: This is based on the gulp task found in the angular/angular repository
40+
execSync('git fetch origin');
41+
// Travis doesn't have master when running jobs on other branches (minor/patch/etc).
42+
execSync(`git fetch origin ${currentBranch}:${currentBranch}`);
43+
4444
const output = execSync('git log ' + currentBranch + '..HEAD --reverse --format="%H %s" --no-merges', {
4545
encoding: 'utf-8'
4646
});
@@ -52,7 +52,7 @@ if (output.length === 0) {
5252
const commitsByLine = output.trim().split(/\n/).map(line => {
5353
return line.trim().split(' ').slice(1).join(' ');
5454
});
55-
logger.info(`Examining ${commitsByLine.length} commit(s) between HEAD and master`);
55+
logger.info(`Examining ${commitsByLine.length} commit(s) between HEAD and ${currentBranch}`);
5656

5757
const someCommitsInvalid = !commitsByLine.every(message => validateCommitMessage(message));
5858

0 commit comments

Comments
 (0)