@@ -1937,9 +1937,12 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
19371937 yield * git ( cwd , [ "init" ] ) ;
19381938 yield * git ( cwd , [ "config" , "user.email" , "[email protected] " ] ) ; 19391939 yield * git ( cwd , [ "config" , "user.name" , "Test" ] ) ;
1940+ // Selected paths add up to more than Linux's default 2 MiB argument limit.
1941+ const dir = "d" . repeat ( 200 ) ;
1942+ yield * fs . makeDirectory ( path . join ( cwd , dir ) ) ;
19401943 const files = Array . from (
19411944 { length : 6_000 } ,
1942- ( _ , index ) => `file-${ String ( index ) . padStart ( 5 , "0" ) } -${ "x" . repeat ( 160 ) } .txt` ,
1945+ ( _ , index ) => `${ dir } / file-${ String ( index ) . padStart ( 5 , "0" ) } -${ "x" . repeat ( 160 ) } .txt` ,
19431946 ) ;
19441947 yield * Effect . forEach ( files , ( file ) => fs . writeFileString ( path . join ( cwd , file ) , "before\n" ) , {
19451948 concurrency : 16 ,
@@ -1965,6 +1968,10 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
19651968 assert . isNotNull ( context ) ;
19661969 assert . isAbove ( context ! . stagedSummary . length , 1_000_000 ) ;
19671970 assert . lengthOf ( context ! . stagedSummary . split ( "\n" ) , files . length ) ;
1971+ const selected = files . slice ( 1 ) ;
1972+ yield * driver . commit ( cwd , "selected" , "" , { stage : { filePaths : selected } } ) ;
1973+ assert . equal ( yield * git ( cwd , [ "log" , "-1" , "--pretty=%s" ] ) , "selected" ) ;
1974+ assert . equal ( yield * git ( cwd , [ "status" , "--porcelain" ] ) , `M ${ files [ 0 ] } ` ) ;
19681975 } ) ,
19691976 ) ;
19701977 describe ( "structured errors" , ( ) => {
@@ -2000,6 +2007,28 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
20002007 } ) ,
20012008 ) ;
20022009
2010+ it . effect ( "fails with a GitCommandError when spawn throws" , ( ) =>
2011+ Effect . gen ( function * ( ) {
2012+ const cwd = yield * makeTmpDir ( ) ;
2013+ const driver = yield * GitVcsDriver . GitVcsDriver ;
2014+
2015+ // Over the OS argument limit, Node's spawn throws E2BIG synchronously.
2016+ const error = yield * driver
2017+ . execute ( {
2018+ operation : "GitVcsDriver.test.spawnThrow" ,
2019+ cwd,
2020+ args : [ "status" , "x" . repeat ( 4 * 1024 * 1024 ) ] ,
2021+ } )
2022+ . pipe ( Effect . flip ) ;
2023+
2024+ assert . deepInclude ( error , {
2025+ _tag : "GitCommandError" ,
2026+ operation : "GitVcsDriver.test.spawnThrow" ,
2027+ detail : "Failed to spawn Git process." ,
2028+ } ) ;
2029+ } ) ,
2030+ ) ;
2031+
20032032 // regression: #8645 name the cause of a failed git command
20042033 it . effect ( "names the branch conflict behind a failed worktree add" , ( ) =>
20052034 Effect . gen ( function * ( ) {
0 commit comments