From 4af514930a417809eddd7ab2df76e8ec146ba773 Mon Sep 17 00:00:00 2001 From: Carlos Florencio Date: Mon, 14 Sep 2026 15:00:03 +0100 Subject: [PATCH] fix(ci): make Git test remotes Windows-safe --- .../server/process/workspace_tracker_test.go | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/apps/backend/internal/agentctl/server/process/workspace_tracker_test.go b/apps/backend/internal/agentctl/server/process/workspace_tracker_test.go index 5ea6761056..09ec348b0f 100644 --- a/apps/backend/internal/agentctl/server/process/workspace_tracker_test.go +++ b/apps/backend/internal/agentctl/server/process/workspace_tracker_test.go @@ -79,12 +79,28 @@ func setupTestRepo(t *testing.T) (string, func()) { runGit(t, localDir, "commit", "-m", "Initial commit") // Add remote and push - runGit(t, localDir, "remote", "add", "origin", remoteDir) + runGit(t, localDir, "remote", "add", "origin", localGitRemotePath(remoteDir)) runGit(t, localDir, "push", "-u", "origin", "main") return localDir, cleanup } +// localGitRemotePath keeps temporary repository paths in the form that Git +// recognizes as local paths on every platform. A raw Windows path such as +// C:\\Temp\\remote.git can be parsed as an SSH-style host named "C", which +// leaves a test waiting for network input. Forward slashes keep the drive +// prefix unambiguous without changing the path returned by Git to callers. +func localGitRemotePath(path string) string { + return filepath.ToSlash(path) +} + +func TestLocalGitRemotePathUsesForwardSlashes(t *testing.T) { + remotePath := filepath.Join(t.TempDir(), "remote.git") + if got := localGitRemotePath(remotePath); strings.ContainsRune(got, '\\') { + t.Fatalf("localGitRemotePath(%q) = %q, want forward slashes", remotePath, got) + } +} + func runGit(t *testing.T, dir string, args ...string) string { t.Helper() // Use git -C flag to ensure we're in the right directory @@ -470,7 +486,7 @@ func TestFilterLocalCommits_PullAndResetScenario(t *testing.T) { writeFile(t, localDir, "README.md", "# Test Repo") runGit(t, localDir, "add", ".") runGit(t, localDir, "commit", "-m", "Initial commit (X)") - runGit(t, localDir, "remote", "add", "origin", remoteDir) + runGit(t, localDir, "remote", "add", "origin", localGitRemotePath(remoteDir)) runGit(t, localDir, "push", "-u", "origin", "main") // Record the starting point (commit X) @@ -478,7 +494,7 @@ func TestFilterLocalCommits_PullAndResetScenario(t *testing.T) { startingSHA = startingSHA[:len(startingSHA)-1] // Clone to upstream clone and make commits there (simulating main evolving) - runGit(t, upstreamClone, "clone", remoteDir, ".") + runGit(t, upstreamClone, "clone", localGitRemotePath(remoteDir), ".") runGit(t, upstreamClone, "config", "user.email", "upstream@test.com") runGit(t, upstreamClone, "config", "user.name", "Upstream User") runGit(t, upstreamClone, "config", "core.hooksPath", "/dev/null") // Disable hooks in test repo