@@ -4903,6 +4903,51 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
49034903 } ) ,
49044904 ) ;
49054905
4906+ it . effect (
4907+ "matches same-repo PR metadata when the remote URL uses a renamed repository slug" ,
4908+ ( ) =>
4909+ Effect . sync ( ( ) => {
4910+ const pr = {
4911+ number : 142 ,
4912+ title : "Renamed repository PR" ,
4913+ url : "https://github.com/octo/new-name/pull/142" ,
4914+ baseRefName : "main" ,
4915+ headRefName : "feature/rename" ,
4916+ state : "open" as const ,
4917+ updatedAt : Option . none ( ) ,
4918+ isCrossRepository : false ,
4919+ headRepositoryNameWithOwner : "octo/new-name" ,
4920+ headRepositoryOwnerLogin : "octo" ,
4921+ } ;
4922+ const headContext = {
4923+ headBranch : "feature/rename" ,
4924+ headRepositoryNameWithOwner : "octo/old-name" ,
4925+ headRepositoryOwnerLogin : "octo" ,
4926+ isCrossRepository : false ,
4927+ } ;
4928+
4929+ expect ( GitManager . matchesBranchHeadContext ( pr , headContext ) ) . toBe ( true ) ;
4930+ // A different owner is never a rename.
4931+ expect (
4932+ GitManager . matchesBranchHeadContext ( pr , {
4933+ ...headContext ,
4934+ headRepositoryNameWithOwner : "someone-else/old-name" ,
4935+ headRepositoryOwnerLogin : "someone-else" ,
4936+ } ) ,
4937+ ) . toBe ( false ) ;
4938+ // Cross-repository heads keep the strict repository comparison.
4939+ expect (
4940+ GitManager . matchesBranchHeadContext (
4941+ { ...pr , isCrossRepository : true } ,
4942+ { ...headContext , isCrossRepository : true } ,
4943+ ) ,
4944+ ) . toBe ( false ) ;
4945+ expect (
4946+ GitManager . matchesBranchHeadContext ( { ...pr , isCrossRepository : true } , headContext ) ,
4947+ ) . toBe ( false ) ;
4948+ } ) ,
4949+ ) ;
4950+
49064951 it . effect ( "creates PR when one does not already exist" , ( ) =>
49074952 Effect . gen ( function * ( ) {
49084953 const repoDir = yield * makeTempDir ( "t3code-git-manager-" ) ;
0 commit comments