From a6ad677b6d6fd264f5dba4e8c633dbc7abaa19a1 Mon Sep 17 00:00:00 2001 From: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com> Date: Wed, 3 Dec 2025 07:58:25 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20fix:=20initialize=20git=20repos?= =?UTF-8?q?=20in=20e2e=20fixtures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The e2e test fixtures created directories but didn't run git init, causing listBranches() to fail with 'Not a git repository' errors. These errors were logged but didn't fail tests since the tests don't rely on branch-loading functionality. Fix: run 'git init -q' for both projectPath and workspacePath so the fixtures behave like real projects. _Generated with mux_ --- tests/e2e/utils/demoProject.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/e2e/utils/demoProject.ts b/tests/e2e/utils/demoProject.ts index d1b3be035c..c6fb88f50a 100644 --- a/tests/e2e/utils/demoProject.ts +++ b/tests/e2e/utils/demoProject.ts @@ -1,5 +1,6 @@ import fs from "fs"; import path from "path"; +import { spawnSync } from "child_process"; import { Config } from "../../../src/node/config"; export interface DemoProjectConfig { @@ -49,6 +50,16 @@ export function prepareDemoProject( fs.mkdirSync(workspacePath, { recursive: true }); fs.mkdirSync(sessionsDir, { recursive: true }); + // Initialize git repos with an initial commit so git commands work properly. + // Empty repos cause errors like "fatal: ref HEAD is not a symbolic ref" when + // detecting the default branch. + for (const repoPath of [projectPath, workspacePath]) { + spawnSync("git", ["init", "-q"], { cwd: repoPath }); + spawnSync("git", ["config", "user.email", "test@example.com"], { cwd: repoPath }); + spawnSync("git", ["config", "user.name", "Test"], { cwd: repoPath }); + spawnSync("git", ["commit", "--allow-empty", "-q", "-m", "init"], { cwd: repoPath }); + } + // E2E tests use legacy workspace ID format to test backward compatibility. // Production code now uses generateStableId() for new workspaces. const config = new Config(rootDir);