Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions apps/server/src/vcs/GitVcsDriver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,26 @@ it.effect("checkpoint capture still fails when a clean filter rejects a file", (
}).pipe(Effect.scoped, Effect.provide(layerGitContract)),
);

it.effect("checkpoint capture keeps LF files that core.safecrlf would refuse to commit", () =>
Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const driver = yield* GitVcsDriver.makeVcsDriverShape();
const cwd = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-checkpoint-safecrlf-" });
const { git, checkpointRef } = yield* makeCheckpointFixture(driver, cwd);
yield* fileSystem.writeFileString(path.join(cwd, ".gitattributes"), "*.txt text eol=crlf\n");
yield* git(["config", "core.safecrlf", "true"]);
yield* fileSystem.writeFileString(path.join(cwd, "untracked.txt"), "new\n");
const originalIndex = yield* fileSystem.readFile(path.join(cwd, ".git", "index"));

yield* driver.checkpoints.captureCheckpoint({ cwd, checkpointRef });

assert.strictEqual((yield* git(["show", `${checkpointRef}:file.txt`])).stdout, "unstaged\n");
assert.strictEqual((yield* git(["show", `${checkpointRef}:untracked.txt`])).stdout, "new\n");
assert.deepEqual(yield* fileSystem.readFile(path.join(cwd, ".git", "index")), originalIndex);
}).pipe(Effect.scoped, Effect.provide(layerGitContract)),
);

it.effect("checkpoint capture refuses a truncated nested repository listing", () =>
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
Expand Down
3 changes: 3 additions & 0 deletions apps/server/src/vcs/GitVcsDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,9 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
...indexConfig,
...durableWrite,
...longPaths,
// safecrlf=true refuses LF files under CRLF conversion; capture them as Git's default does.
"-c",
"core.safecrlf=false",
"add",
...(sparseCheckout ? ["--sparse"] : []),
// add -A rejects ignored directories even when they contain tracked files.
Expand Down
Loading