Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): detect existing PR when remote URL uses a renamed repository slug #20027

Closedjorotodorovv(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/20027/headopened View on GitHub

Showing 2 changed files with 56 additions and 1 deletion.

x
0 of 2 viewed, 2 left
45 additions and 0 deletionsapps/server/src/git/GitManager.test.tsModified
View file
@@ -4903,6 +4903,51 @@
+ it.effect(
+ "matches same-repo PR metadata when the remote URL uses a renamed repository slug",
+ () =>
+ Effect.sync(() => {
+ const pr = {
+ number: 142,
+ title: "Renamed repository PR",
+ url: "https://github.com/octo/new-name/pull/142",
+ baseRefName: "main",
+ headRefName: "feature/rename",
+ state: "open" as const,
+ updatedAt: Option.none(),
+ isCrossRepository: false,
+ headRepositoryNameWithOwner: "octo/new-name",
+ headRepositoryOwnerLogin: "octo",
+ };
+ const headContext = {
+ headBranch: "feature/rename",
+ headRepositoryNameWithOwner: "octo/old-name",
+ headRepositoryOwnerLogin: "octo",
+ isCrossRepository: false,
+ };
+​
+ expect(GitManager.matchesBranchHeadContext(pr, headContext)).toBe(true);
+ // A different owner is never a rename.
+ expect(