Skip to content

Commit 90c4293

Browse files
authored
fix: limit git fetch to cloneDepth config (#2744)
* fix: limit git fetch to cloneDepth config * chore: fix lint
1 parent 8925f13 commit 90c4293

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/local-github.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,12 @@ export class LocalGitHub implements Scm {
115115
}
116116

117117
const branch = gitHubApi.repository.defaultBranch;
118-
logger.debug('Executing: git fetch origin');
119-
await execFile('git', ['fetch', 'origin'], {cwd: repoDir});
118+
const fetchArgs = ['fetch', 'origin'];
119+
if (options.cloneDepth) {
120+
fetchArgs.push('--depth', options.cloneDepth.toString());
121+
}
122+
logger.debug(`Executing: git ${fetchArgs.join(' ')}`);
123+
await execFile('git', fetchArgs, {cwd: repoDir});
120124

121125
logger.debug(`Executing: git checkout ${branch}`);
122126
await execFile('git', ['checkout', branch], {cwd: repoDir});

0 commit comments

Comments
 (0)