diff --git a/src/utils/git.ts b/src/utils/git.ts index 7d10117..3cc7c13 100644 --- a/src/utils/git.ts +++ b/src/utils/git.ts @@ -76,6 +76,7 @@ export async function cloneRepo( ]); const repoGit = simpleGit(repoPath); + await repoGit.raw(["config", "gc.auto", "0"]); await repoGit.raw(["sparse-checkout", "set", ...config.sparse]); await repoGit.fetch(["origin", config.commit]); await repoGit.checkout(config.commit); @@ -87,6 +88,7 @@ export async function cloneRepo( ]); const repoGit = simpleGit(repoPath); + await repoGit.raw(["config", "gc.auto", "0"]); await repoGit.raw(["sparse-checkout", "set", ...config.sparse]); await repoGit.fetch(["--depth=1", "origin", `refs/tags/${config.tag}:refs/tags/${config.tag}`]); await repoGit.checkout(config.tag); @@ -117,6 +119,7 @@ export async function cloneRepo( ]); const repoGit = simpleGit(repoPath); + await repoGit.raw(["config", "gc.auto", "0"]); await repoGit.raw(["sparse-checkout", "set", ...config.sparse]); } diff --git a/tests/utils/git.test.ts b/tests/utils/git.test.ts index 8b79f89..4f5175f 100644 --- a/tests/utils/git.test.ts +++ b/tests/utils/git.test.ts @@ -132,6 +132,7 @@ describe("cloneRepo", () => { expect.stringContaining("aztec-packages"), expect.arrayContaining(["--filter=blob:none", "--sparse", "--no-checkout"]) ); + expect(mockGitInstance.raw).toHaveBeenCalledWith(["config", "gc.auto", "0"]); expect(mockGitInstance.raw).toHaveBeenCalledWith([ "sparse-checkout", "set", @@ -240,6 +241,7 @@ describe("cloneRepo", () => { expect.any(String), expect.arrayContaining(["--filter=blob:none", "--sparse", "--no-checkout"]) ); + expect(mockGitInstance.raw).toHaveBeenCalledWith(["config", "gc.auto", "0"]); expect(mockGitInstance.fetch).toHaveBeenCalledWith(["origin", "abc123def"]); expect(mockGitInstance.checkout).toHaveBeenCalledWith("abc123def"); }); @@ -256,6 +258,7 @@ describe("cloneRepo", () => { expect.any(String), expect.arrayContaining(["--filter=blob:none", "--sparse", "--depth=1", "-b", "master"]) ); + expect(mockGitInstance.raw).toHaveBeenCalledWith(["config", "gc.auto", "0"]); }); it("non-sparse + tag: clones without sparse-checkout", async () => {