From d7540ee2d5f013e58d3446c98c4b977c9ca9a7d4 Mon Sep 17 00:00:00 2001 From: Greg Jackson Date: Thu, 6 Aug 2026 14:26:02 +0100 Subject: [PATCH] fix(browse): add timeout to git check-ignore and clarify false return Addresses review feedback from kraftbj: - Add timeout: 2_000 to Bun.spawnSync to prevent indefinite hangs on network filesystems or slow credential helpers - Add comment explaining why the catch returns false (intentionally collapses "not ignored" and "git errored" since falling through to the text-check is the safe default) Co-Authored-By: Claude Opus 4.6 --- browse/src/config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/browse/src/config.ts b/browse/src/config.ts index 61c9fa32f..f348239de 100644 --- a/browse/src/config.ts +++ b/browse/src/config.ts @@ -82,9 +82,12 @@ function isIgnoredByGit(projectDir: string, relPath: string): boolean { try { const proc = Bun.spawnSync(['git', 'check-ignore', '-q', '--', relPath], { cwd: projectDir, stdout: 'pipe', stderr: 'pipe', + timeout: 2_000, }); return proc.exitCode === 0; } catch { + // git not found, timed out, or not a repo (exit 128). Fall through to + // the text-check path — appending is the safe default when unsure. return false; } }