Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): removing a worktree on Windows no longer deletes what its junctions point to #21099

MergedSunkenInTime(GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/21099/headmerged by juliusmarminge View on GitHub

Showing 5 changed files with 91 additions and 20 deletions (loading 3).

x
0 of 5 viewed, 5 left
67 additions and 0 deletionsapps/server/src/vcs/GitVcsDriverCore.test.tsModified
View file
@@ -3416,6 +3416,73 @@
+ it.effect("force-removes a worktree without deleting what its junctions point to", () =>
+ Effect.gen(function* () {
+ const cwd = yield* makeTmpDir();
+ const { initialBranch } = yield* initRepoWithCommit(cwd);
+ yield* writeTextFile(cwd, ".gitignore", "node_modules\n");
+ yield* git(cwd, ["add", ".gitignore"]);
+ yield* git(cwd, ["commit", "-m", "ignore node_modules"]);
+ const fileSystem = yield* FileSystem.FileSystem;
+ const pathService = yield* Path.Path;
+ const outside = yield* makeTmpDir("git-worktree-link-target-");
+ yield* writeTextFile(outside, "keep.txt", "keep\n");
+ const worktreePath = pathService.join(yield* makeTmpDir("git-worktrees-"), "linked");
+ const driver = yield* GitVcsDriver.GitVcsDriver;
+ yield* driver.createWorktree({
+ cwd,
+ path: worktreePath,
+ refName: initialBranch,
+ newRefName: "feature/linked",
+ });
+ // Junctions on Windows, the way pnpm links packages; symlinks elsewhere.
+ NodeFS.mkdirSync(pathService.join(worktreePath, "node_modules"));
+ NodeFS.symlinkSync(
+ outside,
+ pathService.join(worktreePath, "node_modules", "dep"),
+ "junction",
+ );