Skip to content

Commit 9eb149e

Browse files
Merge commit '51a54955e2' into feat/linux-worktree-reflinks-20260919
2 parents 10f9139 + 51a5495 commit 9eb149e

3 files changed

Lines changed: 29 additions & 2 deletions

File tree

‎apps/server/src/vcs/FileClone.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { GitCommandError } from "@t3tools/contracts";
22
import { HostProcessPlatform } from "@t3tools/shared/hostProcess";
33
import * as Effect from "effect/Effect";
4-
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
4+
import * as ChildProcess from "effect/unstable/process/ChildProcess";
5+
import * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawner";
56

67
/** Forced copy-on-write: unsupported volumes must fail, never silently copy or hardlink. */
78
export const makeFileClone = Effect.fn("makeFileClone")(function* () {

‎apps/server/src/vcs/WorktreeClone.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,31 @@ it.layer(TestLayer)("Worktree cloning", (it) => {
273273
}),
274274
);
275275

276+
it.effect("uses Git for filters activated only in the destination worktree", () =>
277+
Effect.gen(function* () {
278+
const f = yield* fixture();
279+
yield* f.write(".gitattributes", "source.txt filter=conditional\n");
280+
yield* f.git(f.cwd, ["add", ".gitattributes"]);
281+
yield* f.git(f.cwd, ["commit", "-m", "attributes"]);
282+
const config = f.path.join(f.cwd, ".git", "worktree-filters");
283+
yield* f.git(f.cwd, [
284+
"config",
285+
"--file",
286+
config,
287+
"filter.conditional.smudge",
288+
"sed s/original/target/",
289+
]);
290+
yield* f.git(f.cwd, ["config", "includeIf.gitdir:**/worktrees/**.path", config]);
291+
yield* f.driver.createWorktree({
292+
cwd: f.cwd,
293+
path: f.target,
294+
refName: "main",
295+
newRefName: "feature",
296+
});
297+
assert.equal(yield* f.fs.readFileString(f.path.join(f.target, "source.txt")), "target\n");
298+
}),
299+
);
300+
276301
it.effect("seeds opted-in dependencies and relative links but rebuilds caches and shims", () =>
277302
Effect.gen(function* () {
278303
const f = yield* fixture();

‎apps/server/src/vcs/WorktreeClone.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ export const makeWorktreeClone = Effect.fn("makeWorktreeClone")(function* (
4545

4646
// Filters can depend on the checkout path. Sparse/worktree-specific config
4747
// and checkout hooks must retain Git's normal worktree-add semantics.
48+
// Conditional includes can activate different hooks/filters in the target.
4849
const config = yield* git(
4950
cwd,
5051
[
5152
"config",
5253
"--get-regexp",
53-
"^(filter\\.|core\\.sparsecheckout$|extensions\\.worktreeconfig$)",
54+
"^(filter\\.|includeif\\.|core\\.sparsecheckout$|extensions\\.worktreeconfig$)",
5455
],
5556
true,
5657
);

0 commit comments

Comments
 (0)