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
21 changes: 11 additions & 10 deletions apps/server/src/git/GitManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3791,7 +3791,7 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
return { repoDir, manager, providerCalls, firstCommit, pullHead };
});

it.effect.each(["switch", "create-and-switch", "feature-branch"] as const)(
it.effect.each(["switch", "create-and-switch", "feature-branch", "commit"] as const)(
"local PR checkout excludes a concurrent %s from a nested project with an alternate root",
(operation) =>
Effect.gen(function* () {
Expand Down Expand Up @@ -3841,7 +3841,7 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
...manager,
runStackedAction: (input, options) =>
Effect.sync(() => {
events.push("feature-branch");
events.push(input.featureBranch ? "feature-branch" : "commit");
NodeFS.writeFileSync(
NodePath.join(repoDir, "second-client.txt"),
"second client\n",
Expand Down Expand Up @@ -3878,9 +3878,9 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
})
: workflows[1]!.runStackedAction({
cwd: nestedCwd,
actionId: "second-client-feature-branch",
actionId: `second-client-${operation}`,
action: "commit",
featureBranch: true,
featureBranch: operation === "feature-branch",
commitMessage: "Second client commit",
}),
{ startImmediately: true },
Expand All @@ -3893,15 +3893,16 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
expect(events).toEqual([operation]);
expect(prepared).toMatchObject({ branch: "feature/pr-safe", isOnPullRequestHead: true });
expect((yield* runGit(repoDir, ["rev-parse", "main"])).stdout.trim()).toBe(mainCommit);
expect((yield* runGit(repoDir, ["rev-parse", "feature/pr-safe"])).stdout.trim()).toBe(
pullHead,
);
const pullBranch = operation === "commit" ? "feature/pr-safe^" : "feature/pr-safe";
expect((yield* runGit(repoDir, ["rev-parse", pullBranch])).stdout.trim()).toBe(pullHead);
expect((yield* runGit(repoDir, ["branch", "--show-current"])).stdout.trim()).toBe(
operation === "switch"
? "main"
: "branch" in switched
? switched.branch.name
: "second-client",
: operation === "commit"
? "feature/pr-safe"
: "branch" in switched
? switched.branch.name
: "second-client",
);
if ("commit" in switched) {
expect(switched.commit.status).toBe("created");
Expand Down
10 changes: 4 additions & 6 deletions apps/server/src/git/GitWorkflowService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,10 @@ export const make = Effect.gen(function* () {
runStackedAction: Effect.fn("GitWorkflowService.runStackedAction")(function (input, options) {
return ensureGit("GitWorkflowService.runStackedAction", input.cwd).pipe(
Effect.flatMap((handle) =>
input.featureBranch
? withCheckoutLease(
handle.repository.rootPath,
gitManager.runStackedAction(input, options),
)
: gitManager.runStackedAction(input, options),
withCheckoutLease(
handle.repository.rootPath,
gitManager.runStackedAction(input, options),
),
),
);
}),
Expand Down
Loading