FN-5863: harden secondary worktree recovery test path

Tighten the branch-conflicts recovery test to use an isolated secondary worktree root.

- create a unique temporary parent directory for the detached secondary worktree
- track the temporary root for cleanup instead of only the nested worktree path
- keep the reanchor regression focused on detached worktree recovery behavior

Files changed:
 packages/engine/src/__tests__/branch-conflicts-recovery.test.ts | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-5863

Fusion-Task-Lineage: 6cfb02c0-e9fd-456d-a78b-451e3e0707b2
This commit is contained in:
gsxdsm
2026-06-02 00:26:38 -07:00
parent 76a5337833
commit e36fb451a8

View File

@@ -232,9 +232,10 @@ describe("branch contamination recovery classification", () => {
it("reanchors without checkout -B when detached worktree is already at base on bound branch", async () => {
const { repoDir, baseSha } = await setupRepo();
const secondaryWorktree = path.join(tmpdir(), `${path.basename(repoDir)}-feature-secondary`);
const worktreeRoot = await mkdtemp(path.join(tmpdir(), "feature-secondary-"));
dirs.push(worktreeRoot);
const secondaryWorktree = path.join(worktreeRoot, "wt");
await run(`git worktree add --detach ${JSON.stringify(secondaryWorktree)} ${baseSha}`, repoDir);
dirs.push(secondaryWorktree);
await expect(
run(`git checkout -B feature ${baseSha}`, secondaryWorktree),