Add shallow fetch to improve performance for large repositories

This change adds `--depth=1` to git fetch operations to perform shallow
fetches instead of full history downloads. This significantly reduces
checkout time for large repositories as reported in issue #52.

Changes:
- Line 55: Added --depth=1 to PR branch fetch
- Line 102: Added --depth=1 to new branch fetch

Fixes #52

Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
This commit is contained in:
claude[bot]
2025-05-26 02:52:30 +00:00
committed by GitHub
parent 3c6a85b54b
commit 416f74d525

View File

@@ -51,8 +51,8 @@ export async function setupBranch(
const branchName = prData.headRefName; const branchName = prData.headRefName;
// Execute git commands to checkout PR branch // Execute git commands to checkout PR branch (shallow fetch for performance)
await $`git fetch origin ${branchName}`; await $`git fetch origin --depth=1 ${branchName}`;
await $`git checkout ${branchName}`; await $`git checkout ${branchName}`;
console.log(`Successfully checked out PR branch for PR #${entityNumber}`); console.log(`Successfully checked out PR branch for PR #${entityNumber}`);
@@ -98,8 +98,8 @@ export async function setupBranch(
sha: currentSHA, sha: currentSHA,
}); });
// Checkout the new branch // Checkout the new branch (shallow fetch for performance)
await $`git fetch origin ${newBranch}`; await $`git fetch origin --depth=1 ${newBranch}`;
await $`git checkout ${newBranch}`; await $`git checkout ${newBranch}`;
console.log( console.log(