@@ -1464,7 +1464,7 @@ describe("rejected git refs", () => {
14641464} ) ;
14651465
14661466it . layer ( layerTest ) ( "GitVcsDriver core integration" , ( it ) => {
1467- it . effect ( "keeps large change sets available for status and commit preparation" , ( ) =>
1467+ it . effect ( "keeps large change sets available for status, commit preparation and selection " , ( ) =>
14681468 Effect . gen ( function * ( ) {
14691469 const cwd = yield * makeTmpDir ( ) ;
14701470 const fs = yield * FileSystem . FileSystem ;
@@ -1473,10 +1473,13 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
14731473 yield * git ( cwd , [ "init" ] ) ;
14741474 yield * git ( cwd , [ "config" , "user.email" , "[email protected] " ] ) ; 14751475 yield * git ( cwd , [ "config" , "user.name" , "Test" ] ) ;
1476+ // The directory pushes the selected paths past Linux's default 2 MiB ARG_MAX.
1477+ const directory = "d" . repeat ( 200 ) ;
14761478 const files = Array . from (
14771479 { length : 6_000 } ,
1478- ( _ , index ) => `file-${ String ( index ) . padStart ( 5 , "0" ) } -${ "x" . repeat ( 160 ) } .txt` ,
1480+ ( _ , index ) => `${ directory } / file-${ String ( index ) . padStart ( 5 , "0" ) } -${ "x" . repeat ( 160 ) } .txt` ,
14791481 ) ;
1482+ yield * fs . makeDirectory ( path . join ( cwd , directory ) ) ;
14801483 yield * Effect . forEach ( files , ( file ) => fs . writeFileString ( path . join ( cwd , file ) , "before\n" ) , {
14811484 concurrency : 16 ,
14821485 discard : true ,
@@ -1501,6 +1504,13 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
15011504 assert . isNotNull ( context ) ;
15021505 assert . isAbove ( context ! . stagedSummary . length , 1_000_000 ) ;
15031506 assert . lengthOf ( context ! . stagedSummary . split ( "\n" ) , files . length ) ;
1507+ const [ leftOut , ...selected ] = files ;
1508+ yield * driver . commit ( cwd , "selected" , "" , { stage : { filePaths : selected } } ) ;
1509+ assert . equal (
1510+ yield * git ( cwd , [ "show" , "--pretty=" , "--shortstat" , "HEAD" ] ) ,
1511+ "5999 files changed, 5999 insertions(+), 5999 deletions(-)" ,
1512+ ) ;
1513+ assert . equal ( yield * git ( cwd , [ "status" , "--porcelain" ] ) , `M ${ leftOut } ` ) ;
15041514 } ) ,
15051515 ) ;
15061516 describe ( "structured errors" , ( ) => {
@@ -5057,21 +5067,25 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
50575067 const cwd = yield * makeTmpDir ( ) ;
50585068 yield * initRepoWithCommit ( cwd ) ;
50595069 const driver = yield * GitVcsDriver . GitVcsDriver ;
5070+ const selected = [ "selected[1].txt" , "-dash.txt" , "with space.txt" ] ;
5071+ if ( ( yield * HostProcess . Platform ) !== "win32" ) selected . push ( "tab\tand\nnewline.txt" ) ;
50605072
5061- yield * writeTextFile ( cwd , "selected[1].txt" , "literal\n" ) ;
5073+ for ( const file of selected ) yield * writeTextFile ( cwd , file , "literal\n" ) ;
50625074 yield * writeTextFile ( cwd , "selected1.txt" , "pattern match\n" ) ;
50635075
5064- const context = yield * driver . prepareCommitContext ( cwd , [ " selected[1].txt" ] ) ;
5076+ const context = yield * driver . prepareCommitContext ( cwd , selected ) ;
50655077
50665078 assert . include ( context ?. stagedSummary ?? "" , "selected[1].txt" ) ;
50675079 assert . notInclude ( context ?. stagedSummary ?? "" , "selected1.txt" ) ;
50685080 assert . equal ( yield * git ( cwd , [ "diff" , "--cached" , "--name-only" ] ) , "" ) ;
50695081 yield * driver . commit ( cwd , "Add literal path" , "" , {
5070- stage : { filePaths : [ " selected[1].txt" ] } ,
5082+ stage : { filePaths : selected } ,
50715083 } ) ;
5072- assert . equal (
5073- yield * git ( cwd , [ "show" , "--pretty=" , "--name-only" , "HEAD" ] ) ,
5074- "selected[1].txt" ,
5084+ assert . sameMembers (
5085+ ( yield * git ( cwd , [ "show" , "--pretty=" , "--name-only" , "-z" , "HEAD" ] ) )
5086+ . split ( "\0" )
5087+ . filter ( Boolean ) ,
5088+ selected ,
50755089 ) ;
50765090
50775091 const status = yield * git ( cwd , [ "status" , "--porcelain" ] ) ;
0 commit comments