fix: remove automatic orphaned directory cleanup on startup (#128) (#132)

This commit is contained in:
Chris Scott authored and GitHub committed 2026-02-14 08:46:57 -05:00
1 parent 67c750300c
commit 19963f579e
2 files changed
+1 -29

No files matched your search

-24
View File
@@ -710,30 +710,6 @@ function normalizeRepoUrl(url: string, preserveSSH: boolean = false): { url: str
}
}
export async function cleanupOrphanedDirectories(database: Database): Promise<void> {
try {
const reposPath = getReposPath()
await ensureDirectoryExists(reposPath)
const dirResult = await executeCommand(['ls', '-1'], reposPath).catch(() => '')
const directories = dirResult.split('\n').filter(d => d.trim())
if (directories.length === 0) {
return
}
const allRepos = db.listRepos(database)
const trackedPaths = new Set(allRepos.map(r => r.localPath.split('/').pop()))
const orphanedDirs = directories.filter(dir => !trackedPaths.has(dir))
for (const dir of orphanedDirs) {
await executeCommand(['rm', '-rf', dir], reposPath).catch(() => {})
}
} catch {
// Cleanup is best-effort
}
}
async function createWorktreeSafely(baseRepoPath: string, worktreePath: string, branch: string, env: Record<string, string>): Promise<void> {
const currentBranch = await safeGetCurrentBranch(baseRepoPath, env)
if (currentBranch === branch) {