build file changes even when there is no diff
This commit is contained in:
parent
3a7a677a14
commit
018afb52b6
3 changed files with 11 additions and 6 deletions
|
@ -230,6 +230,13 @@ describe('create-or-update-branch tests', () => {
|
|||
expect(workingBaseType).toEqual('commit')
|
||||
})
|
||||
|
||||
it('tests buildBranchFileChanges with no diff', async () => {
|
||||
await git.checkout(BRANCH, BASE)
|
||||
const branchFileChanges = await buildBranchFileChanges(git, BASE, BRANCH)
|
||||
expect(branchFileChanges.additions.length).toEqual(0)
|
||||
expect(branchFileChanges.deletions.length).toEqual(0)
|
||||
})
|
||||
|
||||
it('tests buildBranchFileChanges with addition and modification', async () => {
|
||||
await git.checkout(BRANCH, BASE)
|
||||
const changes = await createChanges()
|
||||
|
|
3
dist/index.js
vendored
3
dist/index.js
vendored
|
@ -290,9 +290,8 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
|
|||
// Check if the pull request branch is ahead of the base
|
||||
result.hasDiffWithBase = yield isAhead(git, base, branch);
|
||||
}
|
||||
if (result.hasDiffWithBase) {
|
||||
// Build the branch file changes
|
||||
result.branchFileChanges = yield buildBranchFileChanges(git, base, branch);
|
||||
}
|
||||
// Get the pull request branch SHA
|
||||
result.headSha = yield git.revParse('HEAD');
|
||||
// Delete the temporary branch
|
||||
|
|
|
@ -333,9 +333,8 @@ export async function createOrUpdateBranch(
|
|||
result.hasDiffWithBase = await isAhead(git, base, branch)
|
||||
}
|
||||
|
||||
if (result.hasDiffWithBase) {
|
||||
// Build the branch file changes
|
||||
result.branchFileChanges = await buildBranchFileChanges(git, base, branch)
|
||||
}
|
||||
|
||||
// Get the pull request branch SHA
|
||||
result.headSha = await git.revParse('HEAD')
|
||||
|
|
Loading…
Reference in a new issue