@@ -12,6 +12,7 @@ import * as HttpClientRequest from "effect/http/HttpClientRequest";
1212import * as HttpClientResponse from "effect/http/HttpClientResponse" ;
1313import { VcsProcessSpawnError } from "@t3tools/contracts" ;
1414import { firstNonEmptyLine } from "@t3tools/source-control-core/server/discovery" ;
15+ import * as HostProcess from "@t3tools/shared/HostProcess" ;
1516import * as TestSourceControlHost from "@t3tools/source-control-testing/TestSourceControlHost" ;
1617
1718import * as ForgejoCli from "./ForgejoCli.ts" ;
@@ -1295,6 +1296,7 @@ it.effect("routes mounted Forgejo repositories without repeating the mount in AP
12951296it . effect ( "prefers fj for HTTP and ported SSH aliases on root servers" , ( ) => {
12961297 const commands : string [ ] = [ ] ;
12971298 const requests : string [ ] = [ ] ;
1299+ let repositoryCwd = "" ;
12981300 return Effect . gen ( function * ( ) {
12991301 const cli = yield * ForgejoCli . make ;
13001302 for ( const remoteUrl of [
@@ -1392,7 +1394,8 @@ it.effect("prefers fj for HTTP and ported SSH aliases on root servers", () => {
13921394 process : {
13931395 run : ( input ) => {
13941396 commands . push ( input . command ) ;
1395- if ( input . command === "git" )
1397+ if ( input . command === "git" ) {
1398+ repositoryCwd = input . cwd ;
13961399 return Effect . succeed (
13971400 input . cwd === "/no-remotes"
13981401 ? processOutput ( "" , { exitCode : ChildProcessSpawner . ExitCode ( 2 ) } )
@@ -1402,10 +1405,11 @@ it.effect("prefers fj for HTTP and ported SSH aliases on root servers", () => {
14021405 : "origin\thttp://forgejo.local:3000/maria/project.git (fetch)\nother\thttp://forgejo.local:3000/maria/other.git (fetch)\nunrelated\thttp://other.local:3000/maria/project.git (fetch)" ,
14031406 ) ,
14041407 ) ;
1408+ }
14051409 assert . strictEqual ( input . command , "fj" ) ;
14061410 assert . deepStrictEqual ( input . args , [
14071411 "--host" ,
1408- input . cwd === "/no-remotes"
1412+ repositoryCwd === "/no-remotes"
14091413 ? "https://forgejo.local:3000"
14101414 : "http://forgejo.local:3000" ,
14111415 "whoami" ,
@@ -1519,11 +1523,13 @@ it.effect("loads later fj review pages when the server caps pages below the requ
15191523 }
15201524 assert . strictEqual ( input . command , "fj" ) ;
15211525 assert . deepStrictEqual ( input . args , [ "--host" , "https://forgejo.test" , "whoami" ] ) ;
1526+ assert . strictEqual ( input . cwd , "/home/maria" ) ;
15221527 return Effect . succeed ( processOutput ( "" ) ) ;
15231528 } ,
15241529 } ,
15251530 } ) ,
15261531 ) ,
1532+ Effect . provideService ( HostProcess . HomeDirectory , "/home/maria" ) ,
15271533 ) ;
15281534} ) ;
15291535
@@ -1680,6 +1686,7 @@ it.effect(
16801686 processOutput ( "http://forgejo.local:3000/maria/project.git\n" ) ,
16811687 ) ;
16821688 if ( input . command === "fj" ) {
1689+ assert . strictEqual ( input . cwd , "/home/maria" ) ;
16831690 if ( scenario === "missing" )
16841691 return Effect . fail (
16851692 new VcsProcessSpawnError ( {
@@ -1727,6 +1734,7 @@ it.effect(
17271734 } ) ,
17281735 ) ,
17291736 ) ,
1737+ Effect . provideService ( HostProcess . HomeDirectory , "/home/maria" ) ,
17301738 ) ;
17311739 }
17321740 } ) ,
0 commit comments