test(worker): isolate GitRepoFixture repos under a unique parent so sibling worktree paths never collide

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-10-01 13:31:26 +02:00
co-authored by Claude Sonnet 5.5
parent c834f17c78
commit a736cf3098
@@ -4,12 +4,16 @@ namespace ClaudeDo.Worker.Tests.Infrastructure;
public sealed class GitRepoFixture : IDisposable
{
private readonly string _rootDir;
public string RepoDir { get; }
public string BaseCommit { get; }
public GitRepoFixture()
{
RepoDir = Path.Combine(Path.GetTempPath(), $"claudedo_gittest_{Guid.NewGuid():N}");
// Repo one level below a unique parent: the sibling worktree root (.claudedo-worktrees) is the repo's parent, so it must be unique per fixture.
_rootDir = Path.Combine(Path.GetTempPath(), $"claudedo_gittest_{Guid.NewGuid():N}");
RepoDir = Path.Combine(_rootDir, "repo");
Directory.CreateDirectory(RepoDir);
RunGit(RepoDir, "init");
@@ -28,7 +32,7 @@ public sealed class GitRepoFixture : IDisposable
try
{
// Force-remove read-only .git objects on Windows.
ForceDeleteDirectory(RepoDir);
ForceDeleteDirectory(_rootDir);
}
catch { /* best effort */ }
}