-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: compare all branch authors when deciding if a branch is modified (
- Loading branch information
Showing
11 changed files
with
119 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,20 @@ describe('util/git/index', () => { | |
await repo.addConfig('user.email', '[email protected]'); | ||
await repo.commit('custom message'); | ||
|
||
await repo.checkoutBranch('renovate/multiple_commits', defaultBranch); | ||
await fs.writeFile(base.path + '/commit1', 'commit1'); | ||
await repo.add(['commit1']); | ||
await repo.addConfig('user.email', '[email protected]'); | ||
await repo.commit('commit1 message'); | ||
await fs.writeFile(base.path + '/commit2', 'commit2'); | ||
await repo.add(['commit2']); | ||
await repo.addConfig('user.email', '[email protected]'); | ||
await repo.commit('commit2 message'); | ||
await fs.writeFile(base.path + '/commit3', 'commit3'); | ||
await repo.add(['commit3']); | ||
await repo.addConfig('user.email', '[email protected]'); | ||
await repo.commit('commit3 message'); | ||
|
||
await repo.checkoutBranch('renovate/nested_files', defaultBranch); | ||
await fs.mkdirp(base.path + '/bin/'); | ||
await fs.writeFile(base.path + '/bin/nested', 'nested'); | ||
|
@@ -275,27 +289,59 @@ describe('util/git/index', () => { | |
|
||
it('should return false when branch is not found', async () => { | ||
expect(await git.isBranchModified('renovate/not_found')).toBeFalse(); | ||
expect( | ||
await git.isBranchModified('renovate/not_found', defaultBranch) | ||
).toBeFalse(); | ||
}); | ||
|
||
it('should return false when author matches', async () => { | ||
expect(await git.isBranchModified('renovate/future_branch')).toBeFalse(); | ||
expect(await git.isBranchModified('renovate/future_branch')).toBeFalse(); | ||
expect( | ||
await git.isBranchModified('renovate/future_branch', defaultBranch) | ||
).toBeFalse(); | ||
}); | ||
|
||
it('should return false when author is ignored', async () => { | ||
git.setUserRepoConfig({ | ||
gitIgnoredAuthors: ['[email protected]'], | ||
}); | ||
expect(await git.isBranchModified('renovate/custom_author')).toBeFalse(); | ||
expect( | ||
await git.isBranchModified('renovate/custom_author', defaultBranch) | ||
).toBeFalse(); | ||
}); | ||
|
||
it('should return false if every author is ignored with multiple commits', async () => { | ||
git.setUserRepoConfig({ | ||
gitIgnoredAuthors: ['[email protected]', '[email protected]'], | ||
}); | ||
expect( | ||
await git.isBranchModified('renovate/multiple_commits', defaultBranch) | ||
).toBeFalse(); | ||
}); | ||
|
||
it('should return true when custom author is unknown', async () => { | ||
expect(await git.isBranchModified('renovate/custom_author')).toBeTrue(); | ||
expect( | ||
await git.isBranchModified('renovate/custom_author', defaultBranch) | ||
).toBeTrue(); | ||
}); | ||
|
||
it('should return true if any commit is modified', async () => { | ||
git.setUserRepoConfig({ | ||
gitIgnoredAuthors: ['[email protected]'], | ||
}); | ||
expect( | ||
await git.isBranchModified('renovate/multiple_commits', defaultBranch) | ||
).toBeTrue(); | ||
}); | ||
|
||
it('should return value stored in modifiedCacheResult', async () => { | ||
modifiedCache.getCachedModifiedResult.mockReturnValue(true); | ||
expect(await git.isBranchModified('renovate/future_branch')).toBeTrue(); | ||
expect( | ||
await git.isBranchModified('renovate/future_branch', defaultBranch) | ||
).toBeTrue(); | ||
}); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters