diff --git a/apps/desktop/electron/gitlock.ts b/apps/desktop/electron/gitlock.ts index 09677e6f8b..4bc396f5ee 100644 --- a/apps/desktop/electron/gitlock.ts +++ b/apps/desktop/electron/gitlock.ts @@ -55,12 +55,16 @@ export async function clearStaleGitLocks( const gitDir = path.join(repoRoot, '.git') const removed: string[] = [] try { - if (!fs.statSync(gitDir).isDirectory()) return removed + if (!fs.statSync(gitDir).isDirectory()) { + return removed + } } catch { return removed } - if (await isGitRunning()) return removed + if (await isGitRunning()) { + return removed + } const cutoff = Date.now() - minAgeMs for (const name of LOCK_NAMES) { diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts index 3bcc28ad53..b7c095ba86 100644 --- a/apps/desktop/electron/main.ts +++ b/apps/desktop/electron/main.ts @@ -162,6 +162,7 @@ import { removeWorktree, switchBranch } from './git-worktree-ops' +import { clearStaleGitLocks } from './gitlock' import { readAndConsumeHandoffResult } from './handoff-result' import { ATTACHMENT_UPLOAD_DEFAULT_MAX_BYTES, @@ -253,7 +254,6 @@ import { resolveCommitLogSelection, shouldCountCommits } from './update-count' -import { clearStaleGitLocks } from './gitlock' import { waitForUpdateClearance } from './update-gate' import { readLiveUpdateMarker, updateHandoffConflict, writeUpdateMarker } from './update-marker' import { isOfficialSshRemote, OFFICIAL_REPO_HTTPS_URL } from './update-remote'