@@ -4363,30 +4363,39 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
43634363 } ) ,
43644364 ) ;
43654365
4366- it . effect ( "fails without a worktree when the t3.json sparse pattern file is missing " , ( ) =>
4366+ it . effect ( "fails without a worktree when the t3.json sparse pattern path is not a file " , ( ) =>
43674367 Effect . gen ( function * ( ) {
43684368 const fileSystem = yield * FileSystem . FileSystem ;
43694369 const pathService = yield * Path . Path ;
43704370 const cwd = yield * makeTmpDir ( ) ;
43714371 const { initialBranch } = yield * initRepoWithCommit ( cwd ) ;
4372- yield * writeTextFile ( cwd , "t3.json" , `{ "worktreeSparsePatternsPath": "missing.txt" }` ) ;
4373- yield * git ( cwd , [ "add" , "t3.json" ] ) ;
4374- yield * git ( cwd , [ "commit" , "-m" , "missing sparse patterns" ] ) ;
4372+ yield * writeTextFile ( cwd , "patterns/keep.txt" , "/*\n" ) ;
43754373 const driver = yield * GitVcsDriver . GitVcsDriver ;
4376- const worktreePath = pathService . join ( yield * makeTmpDir ( "git-worktrees-" ) , "missing" ) ;
4377-
4378- const error = yield * Effect . flip (
4379- driver . createWorktree ( {
4374+ const worktrees = yield * makeTmpDir ( "git-worktrees-" ) ;
4375+ for ( const patternsPath of [ "missing.txt" , "patterns" ] ) {
4376+ yield * writeTextFile (
43804377 cwd ,
4381- path : worktreePath ,
4382- refName : initialBranch ,
4383- newRefName : "feature/missing" ,
4384- } ) ,
4385- ) ;
4378+ "t3.json" ,
4379+ JSON . stringify ( { worktreeSparsePatternsPath : patternsPath } ) ,
4380+ ) ;
4381+ yield * git ( cwd , [ "add" , "." ] ) ;
4382+ yield * git ( cwd , [ "commit" , "-m" , "missing sparse patterns" ] ) ;
4383+ const worktreePath = pathService . join ( worktrees , patternsPath ) ;
4384+
4385+ const error = yield * Effect . flip (
4386+ driver . createWorktree ( {
4387+ cwd,
4388+ path : worktreePath ,
4389+ refName : initialBranch ,
4390+ newRefName : `feature/${ patternsPath } ` ,
4391+ } ) ,
4392+ ) ;
43864393
4387- assert . match ( error . detail , / m i s s i n g \. t x t / ) ;
4388- assert . isFalse ( yield * fileSystem . exists ( worktreePath ) ) ;
4389- assert . notInclude ( yield * git ( cwd , [ "worktree" , "list" ] ) , "missing" ) ;
4394+ assert . include ( error . detail , patternsPath ) ;
4395+ assert . isFalse ( yield * fileSystem . exists ( worktreePath ) ) ;
4396+ assert . notInclude ( yield * git ( cwd , [ "worktree" , "list" ] ) , worktreePath ) ;
4397+ assert . equal ( yield * git ( cwd , [ "branch" , "--list" , `feature/${ patternsPath } ` ] ) , "" ) ;
4398+ }
43904399 } ) ,
43914400 ) ;
43924401
0 commit comments