Skip to content

Commit b1efc9e

Browse files
fix(server): verify missing Git detection with real processes
1 parent 0bb6950 commit b1efc9e

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,11 +1161,16 @@ const vcsProcessSpawning = (command: string) =>
11611161

11621162
it.effect("GitVcsDriver treats a missing git executable as outside any repository", () =>
11631163
Effect.gen(function* () {
1164-
const driver = yield* GitVcsDriver.makeVcsDriverShape();
1164+
const fileSystem = yield* FileSystem.FileSystem;
1165+
const path = yield* Path.Path;
1166+
const cwd = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-missing-git-" });
1167+
const driver = yield* GitVcsDriver.makeVcsDriverShape().pipe(
1168+
Effect.provide(vcsProcessSpawning(path.join(cwd, "git"))),
1169+
);
11651170

1166-
assert.equal(yield* driver.isInsideWorkTree(process.cwd()), false);
1167-
assert.equal(yield* driver.detectRepository(process.cwd()), null);
1168-
}).pipe(Effect.provide(vcsProcessSpawning("t3-missing-git-executable"))),
1171+
assert.strictEqual(yield* driver.isInsideWorkTree(cwd), false);
1172+
assert.strictEqual(yield* driver.detectRepository(cwd), null);
1173+
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
11691174
);
11701175

11711176
it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
@@ -1181,6 +1186,8 @@ it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
11811186

11821187
const error = yield* driver.isInsideWorkTree(process.cwd()).pipe(Effect.flip);
11831188
assert.strictEqual(error._tag, "VcsProcessSpawnError");
1189+
const detectionError = yield* driver.detectRepository(process.cwd()).pipe(Effect.flip);
1190+
assert.strictEqual(detectionError._tag, "VcsProcessSpawnError");
11841191
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
11851192
);
11861193

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,6 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
549549
},
550550
).pipe(
551551
Effect.map((result) => result.exitCode === 0 && result.stdout.trim() === "true"),
552-
// A git that is not installed reads as "not a repository", as a missing hosting CLI does in discovery.
553552
Effect.catchIf(isMissingExecutable, () => Effect.succeed(false)),
554553
);
555554

0 commit comments

Comments
 (0)