@@ -3120,13 +3120,14 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
31203120 yield * writeTextFile ( cwd , "README.md" , "# test\ncommitted\n" ) ;
31213121 yield * git ( cwd , [ "commit" , "-am" , "commit edit" ] ) ;
31223122 yield * writeTextFile ( cwd , "nested/untracked.txt" , "one\ntwo\n" ) ;
3123+ yield * writeTextFile ( cwd , "new [1].txt" , "literal\n" ) ;
31233124
31243125 const status = yield * driver . statusDetailsLocal ( pathService . join ( cwd , "nested" ) , {
31253126 includeBranchChanges : true ,
31263127 } ) ;
31273128 assert . deepStrictEqual ( status . branchChanges , {
31283129 baseRef : "main" ,
3129- insertions : 3 ,
3130+ insertions : 4 ,
31303131 deletions : 0 ,
31313132 } ) ;
31323133 assert . isUndefined ( ( yield * driver . statusDetailsLocal ( cwd ) ) . branchChanges ) ;
@@ -3183,25 +3184,58 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
31833184 Effect . gen ( function * ( ) {
31843185 const cwd = yield * makeTmpDir ( ) ;
31853186 yield * initRepoWithCommit ( cwd ) ;
3186- const driver = yield * GitVcsDriver . GitVcsDriver ;
3187+ const delegate = yield * ChildProcessSpawner . ChildProcessSpawner ;
3188+ const untrackedScanRoots : string [ ] [ ] = [ ] ;
3189+ const spawner = ChildProcessSpawner . make ( ( command ) => {
3190+ if (
3191+ ChildProcess . isStandardCommand ( command ) &&
3192+ command . args . includes ( "ls-files" ) &&
3193+ command . args . includes ( "--others" )
3194+ ) {
3195+ untrackedScanRoots . push ( command . args . slice ( command . args . indexOf ( "--" ) + 1 ) ) ;
3196+ }
3197+ return delegate . spawn ( command ) ;
3198+ } ) ;
3199+ const driver = yield * makeGitVcsDriverCore ( ) . pipe (
3200+ Effect . provideService ( ChildProcessSpawner . ChildProcessSpawner , spawner ) ,
3201+ ) ;
31873202 yield * git ( cwd , [ "branch" , "-M" , "main" ] ) ;
31883203 yield * git ( cwd , [ "checkout" , "-b" , "feature/many-untracked" ] ) ;
3204+ yield * writeTextFile ( cwd , ".git/info/exclude" , "ignored.txt\n" ) ;
3205+ yield * writeTextFile ( cwd , "bulk[1]/ignored.txt" , "ignored\n" ) ;
31893206 yield * Effect . forEach (
3190- Array . from ( { length : 1_001 } , ( _ , index ) => `bulk/${ index } .txt` ) ,
3207+ Array . from ( { length : 1_001 } , ( _ , index ) => `bulk[1] /${ index } .txt` ) ,
31913208 ( file ) => writeTextFile ( cwd , file , "one\ntwo\n" ) ,
31923209 { concurrency : 32 , discard : true } ,
31933210 ) ;
31943211
3195- const status = yield * driver . statusDetailsLocal ( cwd , { includeBranchChanges : true } ) ;
3196- assert . deepStrictEqual ( status . branchChanges , {
3197- baseRef : "main" ,
3198- insertions : 2_002 ,
3199- deletions : 0 ,
3200- } ) ;
3201- assert . deepStrictEqual (
3202- status . workingTree . files . map ( ( file ) => file . path ) ,
3203- [ "bulk/" ] ,
3204- ) ;
3212+ for ( const scenario of [ "normal" , "all" , "no" , "long names" ] ) {
3213+ if ( scenario === "long names" ) {
3214+ yield * Effect . forEach (
3215+ Array . from ( { length : 50 } , ( _ , index ) => `${ "a" . repeat ( 180 ) } -${ index } .txt` ) ,
3216+ ( file ) => writeTextFile ( cwd , file , "long name\n" ) ,
3217+ { concurrency : 32 , discard : true } ,
3218+ ) ;
3219+ }
3220+ const mode = scenario === "long names" ? "normal" : scenario ;
3221+ yield * git ( cwd , [ "config" , "status.showUntrackedFiles" , mode ] ) ;
3222+ untrackedScanRoots . length = 0 ;
3223+ const status = yield * driver . statusDetailsLocal ( cwd , { includeBranchChanges : true } ) ;
3224+ assert . deepStrictEqual ( status . branchChanges , {
3225+ baseRef : "main" ,
3226+ insertions : scenario === "long names" ? 2_052 : 2_002 ,
3227+ deletions : 0 ,
3228+ } ) ;
3229+ assert . deepStrictEqual ( untrackedScanRoots , [
3230+ scenario === "normal" ? [ ":(top,literal)bulk[1]/" ] : [ ] ,
3231+ ] ) ;
3232+ if ( scenario === "normal" ) {
3233+ assert . deepStrictEqual (
3234+ status . workingTree . files . map ( ( file ) => file . path ) ,
3235+ [ "bulk[1]/" ] ,
3236+ ) ;
3237+ }
3238+ }
32053239 } ) ,
32063240 ) ;
32073241
0 commit comments