From 1578154631a16d2f8b222d005456e8a8adeacc3d Mon Sep 17 00:00:00 2001 From: Nicolas Medda Date: Wed, 15 Apr 2026 00:28:37 +0000 Subject: [PATCH] fix(test): configure git user.email/name in integration setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Integration test "returns undefined on detached HEAD" calls `git commit --allow-empty`. That fails on CI runners without a global user.email/user.name configured — `.quiet()` hides the error, so the subsequent checkout --detach has no commit to detach to, HEAD stays on main, and the test assertion fails. Set identity locally on the test repo in beforeAll so every commit works regardless of ambient git config. Verified by running the tests with GIT_CONFIG_GLOBAL=/dev/null (simulates a bare CI runner). --- src/shared/repository/git.integration.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/repository/git.integration.test.ts b/src/shared/repository/git.integration.test.ts index 1f200e2..6b7bda7 100644 --- a/src/shared/repository/git.integration.test.ts +++ b/src/shared/repository/git.integration.test.ts @@ -26,6 +26,10 @@ beforeAll(async () => { nonRepoDir = join(root, "plain"); await $`mkdir -p ${repoDir} ${nestedDir} ${nonRepoDir}`.quiet(); await $`git -C ${repoDir} init -q -b main`.quiet(); + // Set identity locally on this test repo so `git commit` works on CI + // runners that don't have a global user.email/user.name configured. + await $`git -C ${repoDir} config user.email test@bbcli.local`.quiet(); + await $`git -C ${repoDir} config user.name Test`.quiet(); await $`git -C ${repoDir} remote add origin git@bitbucket.org:acme/widgets.git`.quiet(); await $`git -C ${repoDir} remote add upstream https://bitbucket.org/other/widgets.git`.quiet(); });