Skip to content

Commit

Permalink
post-checkout hook always provides a third argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellopez committed Apr 30, 2019
1 parent 7cc3448 commit 6318f32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/package-change-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const defaultCommit2 = 'HEAD';
const hasChangedDependencies = (commitish = []) => {
let commit1 = defaultCommit1;
let commit2 = defaultCommit2;
if (commitish.length === 2) {
if (commitish.length >= 2) {
if (
git.isValidCommitish(commitish[0]) &&
git.isValidCommitish(commitish[1])
Expand Down
4 changes: 3 additions & 1 deletion src/package-change-checker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ describe('package-change-checker.js', () => {
checker.hasChangedDependencies([
'abcdef0123456789abcdef0123456789abcdef01',
'abcdef0123456789abcdef0123456789abcdef02',
'1',
]);
});

Expand Down Expand Up @@ -251,7 +252,7 @@ describe('package-change-checker.js', () => {
});

it('should use default commitish when two invalid commitish are provided', () => {
checker.hasChangedDependencies(['', '']);
checker.hasChangedDependencies(['', '', '1']);
expect(git.isValidCommitish).to.have.been.calledOnceWithExactly('');
expect(git.getDiff).to.have.been.calledOnceWithExactly(
'ORIG_HEAD',
Expand All @@ -264,6 +265,7 @@ describe('package-change-checker.js', () => {
checker.hasChangedDependencies([
'abcdef0123456789abcdef0123456789abcdef01',
'',
'1'
]);
expect(git.isValidCommitish).to.have.been.calledTwice();
expect(git.isValidCommitish).to.have.been.calledWithExactly(
Expand Down

0 comments on commit 6318f32

Please sign in to comment.