Skip to content

Commit 3fa4f4c

Browse files
committed
fix(server): reuse the shared missing-executable check for git
source-control-core exports isMissingExecutable since #19692, so the driver no longer carries its own copy of the predicate.
1 parent 08ede07 commit 3fa4f4c

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

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

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ import * as FileSystem from "effect/FileSystem";
88
import * as Layer from "effect/Layer";
99
import * as Option from "effect/Option";
1010
import * as Path from "effect/Path";
11-
import * as PlatformError from "effect/PlatformError";
1211
import { ChildProcessSpawner } from "effect/process";
1312

1413
import {
1514
GitCommandError,
16-
type VcsError,
1715
VcsProcessExitError,
1816
type VcsSwitchRefInput,
1917
type VcsSwitchRefResult,
@@ -34,6 +32,7 @@ import {
3432
type VcsStatusResult,
3533
type WorktreeSubmodules,
3634
} from "@t3tools/contracts";
35+
import { isMissingExecutable } from "@t3tools/source-control-core/server/discovery";
3736
import {
3837
makeGitVcsDriverCore,
3938
PATCH_RENDER_PREFIX_ARGS,
@@ -522,14 +521,6 @@ const gitCommand = (
522521
: {}),
523522
});
524523

525-
// Spawning a git that is not installed. Repository detection reads this as "not a repository".
526-
const isMissingGitExecutable = (error: VcsError) =>
527-
error._tag === "VcsProcessSpawnError" &&
528-
error.cause instanceof PlatformError.PlatformError &&
529-
error.cause.reason._tag === "NotFound" &&
530-
error.cause.reason.module === "ChildProcess" &&
531-
error.cause.reason.method === "spawn";
532-
533524
export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* () {
534525
const fileSystem = yield* FileSystem.FileSystem;
535526
const path = yield* Path.Path;
@@ -557,7 +548,8 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
557548
},
558549
).pipe(
559550
Effect.map((result) => result.exitCode === 0 && result.stdout.trim() === "true"),
560-
Effect.catchIf(isMissingGitExecutable, () => Effect.succeed(false)),
551+
// A git that is not installed reads as "not a repository", as a missing hosting CLI does in discovery.
552+
Effect.catchIf(isMissingExecutable, () => Effect.succeed(false)),
561553
);
562554

563555
const execute: VcsDriver.VcsDriver["Service"]["execute"] = (input) =>

0 commit comments

Comments
 (0)