@@ -1489,6 +1489,51 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
14891489 } ) ,
14901490 ) ;
14911491
1492+ it . effect ( "allows worktree removal to run longer than the default command timeout" , ( ) =>
1493+ Effect . gen ( function * ( ) {
1494+ const delegate = yield * ChildProcessSpawner . ChildProcessSpawner ;
1495+ const removalStarted = yield * Deferred . make < void > ( ) ;
1496+ const delayedRemovalSpawner = ChildProcessSpawner . make ( ( command ) =>
1497+ Effect . gen ( function * ( ) {
1498+ if (
1499+ ChildProcess . isStandardCommand ( command ) &&
1500+ command . args [ 0 ] === "worktree" &&
1501+ command . args [ 1 ] === "remove"
1502+ ) {
1503+ yield * Deferred . succeed ( removalStarted , undefined ) ;
1504+ yield * Effect . sleep ( "31 seconds" ) ;
1505+ }
1506+ return yield * delegate . spawn ( command ) ;
1507+ } ) ,
1508+ ) ;
1509+ const driver = yield * makeGitVcsDriverCore ( ) . pipe (
1510+ Effect . provideService ( ChildProcessSpawner . ChildProcessSpawner , delayedRemovalSpawner ) ,
1511+ Effect . provide ( ServerConfigLayer ) ,
1512+ ) ;
1513+ const cwd = yield * makeTmpDir ( ) ;
1514+ const { initialBranch } = yield * initRepoWithCommit ( cwd ) ;
1515+ const fileSystem = yield * FileSystem . FileSystem ;
1516+ const pathService = yield * Path . Path ;
1517+ const worktreePath = pathService . join ( yield * makeTmpDir ( "git-worktrees-" ) , "slow-removal" ) ;
1518+
1519+ yield * driver . createWorktree ( {
1520+ cwd,
1521+ path : worktreePath ,
1522+ refName : initialBranch ,
1523+ newRefName : "feature/slow-removal" ,
1524+ } ) ;
1525+
1526+ const removal = yield * driver
1527+ . removeWorktree ( { cwd, path : worktreePath , force : true } )
1528+ . pipe ( Effect . forkChild ( { startImmediately : true } ) ) ;
1529+ yield * Deferred . await ( removalStarted ) ;
1530+ yield * TestClock . adjust ( "31 seconds" ) ;
1531+ yield * Fiber . join ( removal ) ;
1532+
1533+ assert . equal ( yield * fileSystem . exists ( worktreePath ) , false ) ;
1534+ } ) ,
1535+ ) ;
1536+
14921537 it . effect ( "removes the same worktree path twice without failing" , ( ) =>
14931538 Effect . gen ( function * ( ) {
14941539 const cwd = yield * makeTmpDir ( ) ;
0 commit comments