@@ -46,7 +46,6 @@ export namespace FileWatcher {
4646
4747 const state = Instance . state (
4848 async ( ) => {
49- if ( Instance . project . vcs !== "git" ) return { }
5049 log . info ( "init" )
5150 const cfg = await Config . get ( )
5251 const backend = ( ( ) => {
@@ -88,26 +87,28 @@ export namespace FileWatcher {
8887 if ( sub ) subs . push ( sub )
8988 }
9089
91- const vcsDir = await $ `git rev-parse --git-dir`
92- . quiet ( )
93- . nothrow ( )
94- . cwd ( Instance . worktree )
95- . text ( )
96- . then ( ( x ) => path . resolve ( Instance . worktree , x . trim ( ) ) )
97- . catch ( ( ) => undefined )
98- if ( vcsDir && ! cfgIgnores . includes ( ".git" ) && ! cfgIgnores . includes ( vcsDir ) ) {
99- const gitDirContents = await readdir ( vcsDir ) . catch ( ( ) => [ ] )
100- const ignoreList = gitDirContents . filter ( ( entry ) => entry !== "HEAD" )
101- const pending = w . subscribe ( vcsDir , subscribe , {
102- ignore : ignoreList ,
103- backend,
104- } )
105- const sub = await withTimeout ( pending , SUBSCRIBE_TIMEOUT_MS ) . catch ( ( err ) => {
106- log . error ( "failed to subscribe to vcsDir" , { error : err } )
107- pending . then ( ( s ) => s . unsubscribe ( ) ) . catch ( ( ) => { } )
108- return undefined
109- } )
110- if ( sub ) subs . push ( sub )
90+ if ( Instance . project . vcs === "git" ) {
91+ const vcsDir = await $ `git rev-parse --git-dir`
92+ . quiet ( )
93+ . nothrow ( )
94+ . cwd ( Instance . worktree )
95+ . text ( )
96+ . then ( ( x ) => path . resolve ( Instance . worktree , x . trim ( ) ) )
97+ . catch ( ( ) => undefined )
98+ if ( vcsDir && ! cfgIgnores . includes ( ".git" ) && ! cfgIgnores . includes ( vcsDir ) ) {
99+ const gitDirContents = await readdir ( vcsDir ) . catch ( ( ) => [ ] )
100+ const ignoreList = gitDirContents . filter ( ( entry ) => entry !== "HEAD" )
101+ const pending = w . subscribe ( vcsDir , subscribe , {
102+ ignore : ignoreList ,
103+ backend,
104+ } )
105+ const sub = await withTimeout ( pending , SUBSCRIBE_TIMEOUT_MS ) . catch ( ( err ) => {
106+ log . error ( "failed to subscribe to vcsDir" , { error : err } )
107+ pending . then ( ( s ) => s . unsubscribe ( ) ) . catch ( ( ) => { } )
108+ return undefined
109+ } )
110+ if ( sub ) subs . push ( sub )
111+ }
111112 }
112113
113114 return { subs }
0 commit comments