@@ -651,6 +651,40 @@ describe("GitHubSourceControlProvider.checkoutChangeRequest", () => {
651651 } ) . pipe ( Effect . provide ( layer ) ) ;
652652 } ) ;
653653
654+ it . effect ( "adds a fork remote with the protocol of the URL origin fetches from" , ( ) => {
655+ // The harness's `remote.origin.url` config read answers with an SSH second URL.
656+ const { layer, git } = harness ( {
657+ remotes : [
658+ "origin\thttps://github.com/acme/web.git (fetch)" ,
659+ "origin\thttps://github.com/acme/web.git (push)" ,
660+ "origin\[email protected] :acme/web.git (push)" , 661+ ] . join ( "\n" ) ,
662+ graphql : ( ) => ( { pullRequest : node ( 7 , "feature" , "someone" ) } ) ,
663+ api : {
664+ rest : ( input ) => {
665+ const fullName = input . path . slice ( "repos/" . length ) ;
666+ return Effect . succeed (
667+ restResponse ( {
668+ full_name : fullName ,
669+ html_url : `https://github.com/${ fullName } ` ,
670+ ssh_url :
`[email protected] :${ fullName } .git` , 671+ default_branch : "main" ,
672+ } ) ,
673+ ) ;
674+ } ,
675+ } ,
676+ } ) ;
677+ return Effect . gen ( function * ( ) {
678+ const gh = yield * GitHubSourceControlProvider . make ;
679+ yield * gh . checkoutChangeRequest ( { cwd : "/repo" , reference : "7" } ) ;
680+ assert . deepStrictEqual ( git . find ( ( [ name ] ) => name === "ensureRemote" ) ?. [ 1 ] , {
681+ cwd : "/repo" ,
682+ preferredName : "someone" ,
683+ url : "https://github.com/someone/web" ,
684+ } ) ;
685+ } ) . pipe ( Effect . provide ( layer ) ) ;
686+ } ) ;
687+
654688 it . effect ( "keeps git's own output out of what a failed checkout reports" , ( ) => {
655689 const { layer } = harness ( {
656690 remotes :
remotesOutput ( [ "origin" , "[email protected] :acme/web.git" ] ) ,
0 commit comments