Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(vcs): surface git's stderr on GitCommandError #5620

ClosedIAmJSD(GitHub profile, opens in a new tab)wants to merge 7 commits intomain fromrefs/pull/5620/headopened View on GitHub

Showing 3 changed files with 202 additions and 6 deletions (loading 2).

x
0 of 3 viewed, 3 left
202 additions and 6 deletionsapps/server/src/vcs/GitVcsDriverCore.test.tsModified
View file
@@ -42,6 +42,53 @@
getOutputFd: () => Stream.empty,
});
​
+const makeFailingHandle = (stderr: string, exitCode = 128) =>
+ ChildProcessSpawner.makeHandle({
+ pid: ChildProcessSpawner.ProcessId(1),
+ exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(exitCode)),
+ isRunning: Effect.succeed(false),
+ kill: () => Effect.void,
+ unref: Effect.succeed(Effect.void),
+ stdin: Sink.drain,
+ stdout: Stream.empty,
+ stderr: Stream.encodeText(Stream.make(stderr)),
+ all: Stream.empty,
+ getInputFd: () => Sink.drain,
+ getOutputFd: () => Stream.empty,
+ });
+​
+/**
+ * A driver whose every git command exits non-zero with `stderr`.
+ *
+ * `spawns` records what was actually launched, so a test can prove the stub —
+ * and not real git on the developer's machine — produced the failure it is
+ * asserting about.
+ */
+const makeFailingGitLayer = (stderr: string) => {
+ const spawns: Array<ReadonlyArray<string>> = [];
+ const spawner = ChildProcessSpawner.make((command) =>
+ Effect.sync(() => {