From 0493e100f8eefeb3871527118e1b9a855c8a2279 Mon Sep 17 00:00:00 2001 From: "Hyeonjae.Jeong" Date: Thu, 12 Nov 2026 14:37:50 +0900 Subject: [PATCH] test(host-service): reduce git subprocesses when preparing fixtures --- .../host-service/test/helpers/git-fixture.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/host-service/test/helpers/git-fixture.ts b/packages/host-service/test/helpers/git-fixture.ts index e8d27977fd6..550d0fad472 100644 --- a/packages/host-service/test/helpers/git-fixture.ts +++ b/packages/host-service/test/helpers/git-fixture.ts @@ -1,4 +1,10 @@ -import { mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs"; +import { + appendFileSync, + mkdtempSync, + realpathSync, + rmSync, + writeFileSync, +} from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import type { SimpleGit } from "simple-git"; @@ -26,9 +32,10 @@ export async function createGitFixture(): Promise { const git = createUserSimpleGit(repoPath); await git.init(["--initial-branch=main"]); - await git.addConfig("user.email", "test@superset.local"); - await git.addConfig("user.name", "Test Runner"); - await git.addConfig("commit.gpgsign", "false"); + appendFileSync( + join(repoPath, ".git", "config"), + "\n[user]\n\temail = test@superset.local\n\tname = Test Runner\n[commit]\n\tgpgsign = false\n", + ); const commit = async ( message: string, @@ -36,8 +43,9 @@ export async function createGitFixture(): Promise { ): Promise => { for (const [path, contents] of Object.entries(files)) { writeFileSync(join(repoPath, path), contents); - await git.add(path); } + const paths = Object.keys(files); + if (paths.length) await git.raw(["add", "--", ...paths]); const result = await git.commit(message, undefined, { "--allow-empty": null, });