mirror of https://github.com/garrytan/gstack.git
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 <noreply@anthropic.com>
This commit is contained in:
parent
670af8bfbc
commit
d7540ee2d5
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue