@@ -188,6 +188,31 @@ describe("inspectLocalRepo", () => {
188188 expect ( info . repo ) . toBe ( "infra" )
189189 } )
190190
191+ it ( "falls back to a non-origin remote when there is no origin" , async ( ) => {
192+ const info = await inspect ( "/home/me/fork" , {
193+ dirs : [ "/home/me/fork" ] ,
194+ commands : [
195+ { command : "git" , args : [ "remote" ] , outputLines : [ "upstream" ] , exitCode : 0 } ,
196+ {
197+ command : "git" ,
198+ args : [ "remote" , "get-url" , "upstream" ] ,
199+ outputLines : [ "git@github.com:acme/infra.git" ] ,
200+ exitCode : 0 ,
201+ } ,
202+ lsFiles ( [ "main.tf" ] ) ,
203+ ] ,
204+ git : {
205+ getRepoRoot : ( ) => Effect . succeed ( "/home/me/fork" ) ,
206+ // getInfo only looks at origin, which this checkout doesn't have.
207+ getInfo : ( ) => Effect . succeed ( { branch : "main" , refType : "branch" as const } ) ,
208+ } ,
209+ } )
210+
211+ expect ( info . remoteUrl ) . toBe ( "git@github.com:acme/infra.git" )
212+ expect ( info . owner ) . toBe ( "acme" )
213+ expect ( info . repo ) . toBe ( "infra" )
214+ } )
215+
191216 it ( "omits owner/repo when the repo has no remote" , async ( ) => {
192217 const info = await inspect ( "/home/me/local-only" , {
193218 dirs : [ "/home/me/local-only" ] ,
0 commit comments