Skip to content

Commit

Permalink
When base is set, fetch depth=1
Browse files Browse the repository at this point in the history
  • Loading branch information
webmonarch committed Mar 7, 2024
1 parent b3a2c5d commit fb90a24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
if (workingBase != base) {
core.info(`Rebasing commits made to ${workingBaseType} '${workingBase}' on to base branch '${base}'`);
// Checkout the actual base
yield git.fetch([`${base}:${base}`], baseRemote, ['--force']);
yield git.fetch([`${base}:${base}`], baseRemote, ['--force', '--depth=1']);
yield git.checkout(base);
// Cherrypick commits from the temporary branch starting from the working base
const commits = yield git.revList([`${workingBase}..${tempBranch}`, '.'], ['--reverse']);
Expand Down
5 changes: 3 additions & 2 deletions src/create-or-update-branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export async function tryFetch(
): Promise<boolean> {
try {
await git.fetch([`${branch}:refs/remotes/${remote}/${branch}`], remote, [
'--force'
'--force',
'--depth=1'
])
return true
} catch {
Expand Down Expand Up @@ -200,7 +201,7 @@ export async function createOrUpdateBranch(
`Rebasing commits made to ${workingBaseType} '${workingBase}' on to base branch '${base}'`
)
// Checkout the actual base
await git.fetch([`${base}:${base}`], baseRemote, ['--force'])
await git.fetch([`${base}:${base}`], baseRemote, ['--force', '--depth=1'])
await git.checkout(base)
// Cherrypick commits from the temporary branch starting from the working base
const commits = await git.revList(
Expand Down

0 comments on commit fb90a24

Please sign in to comment.