mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
perf: shallow fetch the actual base when rebasing from working base (#2816)
* Update git.fetch calls to use depth=1 (#2810) * When base is set, fetch depth=1 * PR Feedback - remove depth=1 from tryFetch function * push-to-fork fix * test updates to handle shallow fetch of base --------- Co-authored-by: Eric Webb <eric@collectivegenius.net>
This commit is contained in:
parent
57a101480a
commit
70a41aba78
3 changed files with 35 additions and 12 deletions
|
@ -199,8 +199,13 @@ export async function createOrUpdateBranch(
|
|||
core.info(
|
||||
`Rebasing commits made to ${workingBaseType} '${workingBase}' on to base branch '${base}'`
|
||||
)
|
||||
const fetchArgs = ['--force']
|
||||
if (branchRemoteName != 'fork') {
|
||||
// If pushing to a fork we cannot shallow fetch otherwise the 'shallow update not allowed' error occurs
|
||||
fetchArgs.push('--depth=1')
|
||||
}
|
||||
// Checkout the actual base
|
||||
await git.fetch([`${base}:${base}`], baseRemote, ['--force'])
|
||||
await git.fetch([`${base}:${base}`], baseRemote, fetchArgs)
|
||||
await git.checkout(base)
|
||||
// Cherrypick commits from the temporary branch starting from the working base
|
||||
const commits = await git.revList(
|
||||
|
@ -219,7 +224,7 @@ export async function createOrUpdateBranch(
|
|||
// Reset the temp branch to the working index
|
||||
await git.checkout(tempBranch, 'HEAD')
|
||||
// Reset the base
|
||||
await git.fetch([`${base}:${base}`], baseRemote, ['--force'])
|
||||
await git.fetch([`${base}:${base}`], baseRemote, fetchArgs)
|
||||
}
|
||||
|
||||
// Try to fetch the pull request branch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue