Stabilize git workspace and terminal tests (#2540)

Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
Julius MarmingeandJulius Marminge authored and GitHub committed 2026-05-05 20:31:44 -07:00
1 parent 536dcad19e
commit 25c9d267ac
2 files changed
+61 -42

No files matched your search

+60 -39
View File
@@ -294,6 +294,18 @@ function configureRemote(
});
}
function configureVisibleRemoteUrlWithLocalRewrite(
cwd: string,
remoteName: string,
visibleUrl: string,
localRemotePath: string,
): Effect.Effect<void, GitCommandError, GitVcsDriver.GitVcsDriver> {
return Effect.gen(function* () {
yield* runGit(cwd, ["config", `remote.${remoteName}.url`, visibleUrl]);
yield* runGit(cwd, ["config", `url.${localRemotePath}.insteadOf`, visibleUrl]);
});
}
function createTextGeneration(overrides: Partial<FakeGitTextGeneration> = {}): TextGenerationShape {
const implementation: FakeGitTextGeneration = {
generateCommitMessage: (input) =>
@@ -1012,11 +1024,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-488/statemachine"]);
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
yield* runGit(repoDir, [
"config",
"remote.fork-seed.url",
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:jasonLaster/codething-mvp.git",
]);
forkDir,
);
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
@@ -1076,17 +1089,19 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
yield* runGit(repoDir, ["checkout", "-b", "effect-atom"]);
yield* runGit(repoDir, ["push", "-u", "origin", "effect-atom"]);
yield* runGit(repoDir, ["push", "-u", "my-org/upstream", "effect-atom"]);
yield* runGit(repoDir, [
"config",
"remote.origin.url",
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"origin",
"[email protected]:pingdotgg/codething-mvp.git",
]);
originDir,
);
yield* runGit(repoDir, ["config", "remote.origin.pushurl", originDir]);
yield* runGit(repoDir, [
"config",
"remote.my-org/upstream.url",
"[email protected]:pingdotgg/codething-mvp.git",
]);
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"my-org/upstream",
"ssh://[email protected]/pingdotgg/codething-mvp.git",
upstreamDir,
);
yield* runGit(repoDir, ["config", "remote.my-org/upstream.pushurl", upstreamDir]);
yield* runGit(repoDir, ["checkout", "main"]);
yield* runGit(repoDir, ["branch", "-D", "effect-atom"]);
@@ -1861,11 +1876,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
const forkDir = yield* createBareRemote();
yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* runGit(repoDir, [
"config",
"remote.fork-seed.url",
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:octocat/codething-mvp.git",
]);
forkDir,
);
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
@@ -1923,17 +1939,19 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
yield* runGit(repoDir, ["checkout", "-b", "effect-atom"]);
yield* runGit(repoDir, ["push", "-u", "origin", "effect-atom"]);
yield* runGit(repoDir, ["push", "-u", "my-org/upstream", "effect-atom"]);
yield* runGit(repoDir, [
"config",
"remote.origin.url",
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"origin",
"[email protected]:pingdotgg/codething-mvp.git",
]);
originDir,
);
yield* runGit(repoDir, ["config", "remote.origin.pushurl", originDir]);
yield* runGit(repoDir, [
"config",
"remote.my-org/upstream.url",
"[email protected]:pingdotgg/codething-mvp.git",
]);
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"my-org/upstream",
"ssh://[email protected]/pingdotgg/codething-mvp.git",
upstreamDir,
);
yield* runGit(repoDir, ["config", "remote.my-org/upstream.pushurl", upstreamDir]);
yield* runGit(repoDir, ["checkout", "main"]);
yield* runGit(repoDir, ["branch", "-D", "effect-atom"]);
@@ -2013,11 +2031,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]);
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
yield* runGit(repoDir, [
"config",
"remote.fork-seed.url",
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:octocat/codething-mvp.git",
]);
forkDir,
);
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
@@ -2083,11 +2102,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]);
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
yield* runGit(repoDir, [
"config",
"remote.fork-seed.url",
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:octocat/codething-mvp.git",
]);
forkDir,
);
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
@@ -2263,11 +2283,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-91/statemachine"]);
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
yield* runGit(repoDir, [
"config",
"remote.fork-seed.url",
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:octocat/codething-mvp.git",
]);
forkDir,
);
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
@@ -3147,7 +3168,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
fs.writeFileSync(path.join(repoDir, "hooked.txt"), "hooked\n");
fs.writeFileSync(
path.join(repoDir, ".git", "hooks", "pre-commit"),
'#!/bin/sh\necho "hook: start" >&2\nsleep 1\necho "hook: end" >&2\n',
'#!/bin/sh\necho "hook: start" >&2\nsleep 0.05\necho "hook: end" >&2\n',
{ mode: 0o755 },
);
@@ -238,9 +238,7 @@ const createManager = (
...(options.subprocessPollIntervalMs !== undefined
? { subprocessPollIntervalMs: options.subprocessPollIntervalMs }
: {}),
...(options.processKillGraceMs !== undefined
? { processKillGraceMs: options.processKillGraceMs }
: {}),
processKillGraceMs: options.processKillGraceMs ?? 1,
...(options.maxRetainedInactiveSessions !== undefined
? { maxRetainedInactiveSessions: options.maxRetainedInactiveSessions }
: {}),