@@ -639,8 +639,14 @@ export const make = Effect.gen(function* () {
639639 const serverConfig = yield * ServerConfig . ServerConfig ;
640640 const serverSettings = yield * ServerSettings . ServerSettingsService ;
641641 const projectStore = yield * ProjectStore . ProjectStoreV2 ;
642- const baseDir = path . resolve ( serverConfig . baseDir ) ;
643- const worktreesDir = path . resolve ( serverConfig . worktreesDir ) ;
642+ const withResolvedLinks = ( directory : string ) =>
643+ fileSystem . realPath ( directory ) . pipe (
644+ Effect . map ( ( realPath ) => [ directory , realPath ] ) ,
645+ Effect . orElseSucceed ( ( ) => [ directory ] ) ,
646+ ) ;
647+ // Candidates are also checked with links resolved, so T3's own folders need both spellings.
648+ const baseDirs = yield * withResolvedLinks ( path . resolve ( serverConfig . baseDir ) ) ;
649+ const worktreesDirs = yield * withResolvedLinks ( path . resolve ( serverConfig . worktreesDir ) ) ;
644650 const foldWorktreeCase = ( yield * HostProcess . Platform ) === "win32" ;
645651 const hostEnvironment = yield * HostProcess . Environment ;
646652 const homeDir = yield * HostProcess . HomeDirectory ;
@@ -662,10 +668,14 @@ export const make = Effect.gen(function* () {
662668 normalizeForWorktreeMatch ( ancestor , foldWorktreeCase ) ,
663669 ) ,
664670 ) ||
665- normalizeForWorktreeMatch ( candidatePath , foldWorktreeCase ) . startsWith (
666- normalizeForWorktreeMatch ( baseDir , foldWorktreeCase ) ,
671+ baseDirs . some ( ( baseDir ) =>
672+ normalizeForWorktreeMatch ( candidatePath , foldWorktreeCase ) . startsWith (
673+ normalizeForWorktreeMatch ( baseDir , foldWorktreeCase ) ,
674+ ) ,
667675 ) ||
668- isT3ManagedWorktree ( candidatePath , worktreesDir , foldWorktreeCase ) ;
676+ worktreesDirs . some ( ( worktreesDir ) =>
677+ isT3ManagedWorktree ( candidatePath , worktreesDir , foldWorktreeCase ) ,
678+ ) ;
669679
670680 const listDirectory = ( directory : string ) =>
671681 fileSystem . readDirectory ( directory ) . pipe ( Effect . orElseSucceed ( ( ) : ReadonlyArray < string > => [ ] ) ) ;
0 commit comments