@@ -1365,20 +1365,23 @@ describe("VcsStatusBroadcaster", () => {
13651365
13661366 it . effect ( "a checkout read that fails while index.lock is held retries until it succeeds" , ( ) =>
13671367 Effect . gen ( function * ( ) {
1368- const fs = yield * FileSystem . FileSystem ;
1369- const path = yield * Path . Path ;
1370- const gitDir = yield * fs . makeTempDirectoryScoped ( { prefix : "vcs-head-watch-" } ) ;
1371- const headPath = path . join ( gitDir , "HEAD" ) ;
1372- yield * fs . writeFileString ( headPath , "ref: refs/heads/main\n" ) ;
1368+ const events = yield * Queue . unbounded < FileSystem . WatchEvent > ( ) ;
1369+ const headPath = "/repo/.git/HEAD" ;
13731370 const failed = yield * Deferred . make < void > ( ) ;
1374- const state = {
1371+ const state : Parameters < typeof layerTestFor > [ 0 ] = {
13751372 currentLocalStatus : { ...baseLocalStatus , isDefaultRef : true , refName : "main" } ,
13761373 currentRemoteStatus : null ,
13771374 localStatusCalls : 0 ,
13781375 remoteStatusCalls : 0 ,
13791376 localInvalidationCalls : 0 ,
13801377 remoteInvalidationCalls : 0 ,
13811378 headPath,
1379+ fileSystem : FileSystem . makeNoop ( {
1380+ realPath : ( target ) => Effect . succeed ( target ) ,
1381+ exists : ( ) => Effect . succeed ( true ) ,
1382+ watch : ( _target , options ) =>
1383+ Stream . fromQueue ( events ) . pipe ( Stream . onStart ( Effect . sync ( ( ) => options ?. onReady ?.( ) ) ) ) ,
1384+ } ) ,
13821385 failLocalStatus : false ,
13831386 onLocalStatusFailure : Deferred . succeed ( failed , undefined ) . pipe ( Effect . asVoid ) ,
13841387 } ;
@@ -1402,9 +1405,7 @@ describe("VcsStatusBroadcaster", () => {
14021405 // A terminal commit holds index.lock across the checkout, so the HEAD event's read fails.
14031406 state . failLocalStatus = true ;
14041407 state . currentLocalStatus = { ...baseLocalStatus , isDefaultRef : false , refName : "repro" } ;
1405- const lockPath = path . join ( gitDir , "HEAD.lock" ) ;
1406- yield * fs . writeFileString ( lockPath , "ref: refs/heads/repro\n" ) ;
1407- yield * fs . rename ( lockPath , headPath ) ;
1408+ yield * Queue . offer ( events , { _tag : "Update" , path : "HEAD" } ) ;
14081409 yield * Deferred . await ( failed ) ;
14091410 const failedCalls = state . localStatusCalls ;
14101411
@@ -1414,7 +1415,7 @@ describe("VcsStatusBroadcaster", () => {
14141415 yield * Deferred . await ( checkedOut ) ;
14151416 assert . strictEqual ( state . localStatusCalls , failedCalls + 1 ) ;
14161417 } ) . pipe ( Effect . provide ( layerTestFor ( state ) ) , Effect . scoped ) ;
1417- } ) . pipe ( Effect . provide ( NodeServices . layer ) , Effect . scoped ) ,
1418+ } ) . pipe ( Effect . scoped ) ,
14181419 ) ;
14191420
14201421 it . effect ( "subscribers share one HEAD watch that ends with the last of them" , ( ) =>
@@ -1555,13 +1556,13 @@ describe("VcsStatusBroadcaster", () => {
15551556 yield * Effect . gen ( function * ( ) {
15561557 const broadcaster = yield * VcsStatusBroadcaster . VcsStatusBroadcaster ;
15571558 const branches = yield * Stream . toPull ( broadcaster . streamBranchStatus ( { cwd : "/repo" } ) ) ;
1558- assert . deepEqual ( yield * branches , [ { refName : "main" } ] ) ;
1559+ assert . deepEqual ( yield * branches , [ { refName : "main" , isRepo : true } ] ) ;
15591560
15601561 // Every checkout removes HEAD.lock, which leaves the watch running.
15611562 state . currentLocalStatus = { ...baseLocalStatus , refName : "other" } ;
15621563 yield * Queue . offer ( events , { _tag : "Remove" , path : "HEAD.lock" } ) ;
15631564 yield * Queue . offer ( events , { _tag : "Update" , path : "HEAD" } ) ;
1564- assert . deepEqual ( yield * branches , [ { refName : "other" } ] ) ;
1565+ assert . deepEqual ( yield * branches , [ { refName : "other" , isRepo : true } ] ) ;
15651566
15661567 // `git worktree remove` deletes the watched directory; Windows keeps reporting it.
15671568 gitDirExists = false ;
0 commit comments