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
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ it.layer(layerBase, { excludeTestServices: true })("PullRequestReviewGuideServic
),
);

it.effect("keeps excerpts of source lines a configured diff driver would convert away", () =>
it.effect("keeps excerpts despite the checkout's diff driver and a failing hook", () =>
Effect.scoped(
Effect.gen(function* () {
const repositories = yield* makeRepositories;
Expand All @@ -477,6 +477,9 @@ it.layer(layerBase, { excludeTestServices: true })("PullRequestReviewGuideServic
"feature.txt diff=blank\n",
);
yield* git(repositories.workspace, ["config", "diff.blank.textconv", "true"]);
const hook = `${repositories.workspace}/.git/hooks/post-checkout`;
yield* fs.writeFileString(hook, "#!/bin/sh\nexit 1\n");
yield* fs.chmod(hook, 0o755);
const stored = yield* Deferred.make<void>();
const context = yield* Layer.build(
makeLayer({
Expand All @@ -502,9 +505,10 @@ it.layer(layerBase, { excludeTestServices: true })("PullRequestReviewGuideServic
context,
PullRequestReviewGuideService.PullRequestReviewGuideService,
);
yield* service.generate(reference);
yield* Deferred.await(stored);
const result = yield* service.get(reference);
const runs = yield* watchRuns;
yield* runs.generate(service, reference);
const result = yield* runs.settled(service, reference);
assert.notStrictEqual(result.run?._tag, "Failed", JSON.stringify(result.run));
assert.deepStrictEqual(result.guide?.stops[0]?.excerpts, [
{ path: "feature.txt", side: "new", start: 1, end: 3, caption: "" },
]);
Expand Down
12 changes: 11 additions & 1 deletion apps/server/src/pullRequest/PullRequestReviewGuideService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,17 @@ const make = Effect.gen(function* () {
yield* git.execute({
operation: "PullRequestReviewGuideService.addWorktree",
cwd: workspaceRoot,
args: ["worktree", "add", "--detach", "--quiet", path, resolvedHead.commitSha],
// Scratch checkout for reading the change: repository hooks (installs, LFS) only slow or fail it.
args: [
"-c",
"core.hooksPath=/dev/null",
"worktree",
"add",
"--detach",
"--quiet",
path,
resolvedHead.commitSha,
],
timeoutMs: 5 * 60_000,
});
yield* Effect.addFinalizer(() =>
Expand Down
Loading