@@ -2189,6 +2189,55 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
21892189 } ) ,
21902190 ) ;
21912191
2192+ it . effect ( "explains a non-fast-forward push from a host with a translated Git" , ( ) =>
2193+ Effect . gen ( function * ( ) {
2194+ const cwd = yield * makeTmpDir ( ) ;
2195+ const { initialBranch } = yield * initRepoWithCommit ( cwd ) ;
2196+ const remote = yield * makeTmpDir ( "git-remote-" ) ;
2197+ const other = yield * makeTmpDir ( "git-other-" ) ;
2198+ yield * git ( remote , [ "init" , "--bare" ] ) ;
2199+ yield * git ( cwd , [ "remote" , "add" , "origin" , remote ] ) ;
2200+ yield * git ( cwd , [ "push" , "--set-upstream" , "origin" , initialBranch ] ) ;
2201+ yield * git ( other , [ "clone" , "--branch" , initialBranch , remote , "." ] ) ;
2202+ yield * git ( other , [
2203+ "-c" ,
2204+ "user.email=t@t" ,
2205+ "-c" ,
2206+ "user.name=T" ,
2207+ "commit" ,
2208+ "--allow-empty" ,
2209+ "-m" ,
2210+ "remote" ,
2211+ ] ) ;
2212+ yield * git ( other , [ "push" , "origin" , initialBranch ] ) ;
2213+ yield * git ( cwd , [ "commit" , "--allow-empty" , "-m" , "local" ] ) ;
2214+ const locales : Array < CommandLine . Word | undefined > = [ ] ;
2215+ const delegate = yield * ChildProcessSpawner . ChildProcessSpawner ;
2216+ const spawner = ChildProcessSpawner . make ( ( command ) => {
2217+ if ( ChildProcess . isStandardCommand ( command ) && command . args . includes ( "push" ) ) {
2218+ locales . push ( command . options . env ?. LANGUAGE ) ;
2219+ }
2220+ return delegate . spawn ( command ) ;
2221+ } ) ;
2222+ const driver = yield * makeGitVcsDriverCore ( ) . pipe (
2223+ Effect . provideService ( ChildProcessSpawner . ChildProcessSpawner , spawner ) ,
2224+ Effect . provide ( layerServerConfig ) ,
2225+ ) ;
2226+ const hostEnv = yield * HostProcess . Environment ;
2227+
2228+ const error = yield * driver
2229+ . pushCurrentBranch ( cwd , null )
2230+ . pipe (
2231+ Effect . provideService ( HostProcess . Environment , { ...hostEnv , LANGUAGE : "de" } ) ,
2232+ Effect . flip ,
2233+ ) ;
2234+
2235+ assert . equal ( error . reason , "push_rejected_non_fast_forward" ) ;
2236+ assert . isNotEmpty ( locales ) ;
2237+ for ( const locale of locales ) assert . equal ( locale , "C" ) ;
2238+ } ) ,
2239+ ) ;
2240+
21922241 it . effect ( "lets a slow remote branch checkout finish without blocking config writes" , ( ) =>
21932242 Effect . gen ( function * ( ) {
21942243 const cwd = yield * makeTmpDir ( ) ;
0 commit comments