Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(gitCommitInfo): update `git fetch` command to minimize the work (#35730)

Dmitry Gozman0d7403fbdb9e
diff --git a/packages/playwright/src/plugins/gitCommitInfoPlugin.ts b/packages/playwright/src/plugins/gitCommitInfoPlugin.ts
index c33d57359b..06a67f41ee 100644
--- a/packages/playwright/src/plugins/gitCommitInfoPlugin.ts
+++ b/packages/playwright/src/plugins/gitCommitInfoPlugin.ts
@@ -152,7 +152,8 @@ async function gitCommitInfo(gitDir: string): Promise<GitCommitInfo | undefined>
async function gitDiff(gitDir: string, ci?: CIInfo): Promise<string | undefined> {
const diffLimit = 100_000;
if (ci?.prBaseHash) {
- await runGit(`git fetch origin ${ci.prBaseHash}`, gitDir);
+ // https://git-scm.com/docs/git-fetch
+ await runGit(`git fetch origin ${ci.prBaseHash} --depth=1 --no-auto-maintenance --no-auto-gc --no-tags --no-recurse-submodules`, gitDir);
const diff = await runGit(`git diff ${ci.prBaseHash} HEAD`, gitDir);
if (diff)
return diff.substring(0, diffLimit);