Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 3 additions & 4 deletions apps/server/src/gitManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ describe("GitManager", () => {
expect(result.push.status).toBe("skipped_up_to_date");
});

it("opens existing PR for commit/push/pr action", async () => {
it("returns existing PR metadata for commit/push/pr action", async () => {
const repoDir = makeTempDir("t3code-git-manager-");
await initRepo(repoDir);
await runGit(repoDir, ["checkout", "-b", "feature/existing-pr"]);
Expand Down Expand Up @@ -376,9 +376,7 @@ describe("GitManager", () => {

expect(result.pr.status).toBe("opened_existing");
expect(result.pr.number).toBe(42);
expect(
ghCalls.some((call) => call.startsWith("pr view feature/existing-pr --web")),
).toBe(true);
expect(ghCalls.some((call) => call.startsWith("pr view "))).toBe(false);
});

it("creates PR when one does not already exist", async () => {
Expand Down Expand Up @@ -422,6 +420,7 @@ describe("GitManager", () => {
expect(
ghCalls.some((call) => call.includes("pr create --base main --head feature-create-pr")),
).toBe(true);
expect(ghCalls.some((call) => call.startsWith("pr view "))).toBe(false);
});

it("rejects push/pr actions from detached HEAD", async () => {
Expand Down
10 changes: 0 additions & 10 deletions apps/server/src/gitManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ export class GitManager {

const existing = await this.findOpenPr(cwd, branch);
if (existing) {
await this.openPrInBrowser(cwd, branch);
return {
status: "opened_existing",
url: existing.url,
Expand Down Expand Up @@ -381,7 +380,6 @@ export class GitManager {
}

const created = await this.findOpenPr(cwd, branch);
await this.openPrInBrowser(cwd, branch);

if (!created) {
return {
Expand All @@ -402,14 +400,6 @@ export class GitManager {
};
}

private async openPrInBrowser(cwd: string, branch: string): Promise<void> {
try {
await this.runGh(cwd, ["pr", "view", branch, "--web"]);
} catch {
// Opening the browser is best-effort.
}
}

private async findOpenPr(
cwd: string,
branch: string,
Expand Down
Loading