orca/src
Omar Shahine 91e7e1d91c
fix: detect valid repos when git rev-parse can't confirm (#6173)
* fix: detect valid repos when git rev-parse can't confirm

isGitRepo() has depended entirely on a successful `git rev-parse`
since 18ed7b27d, with catch blocks that collapse every failure into
"not a git repository". When that subprocess fails for a reason
unrelated to repo-ness — a transient spawn / git-shim hiccup in the
packaged app, main-process resource pressure, or a config-level error —
a real repository is silently downgraded to a plain folder. The folder
scanner already tolerates this via a `.git` marker, so the scan reports
"git_repo" but the subsequent addRepo throws, producing the spurious
"Open as Folder" prompt for a valid repo.

Keep `git rev-parse` as the authoritative positive signal, but on any
non-positive result fall back to a validated `.git` marker instead of
returning false: `.git` dir must contain HEAD, a `.git` file must point
at a gitdir, and bare roots need HEAD + objects/ + refs/. A garbage
`.git` file and an empty `.git/` are still rejected, preserving the
validation 18ed7b27d added. Logs a warning when recovery via the marker
happens so the underlying probe failure stays visible.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: address review feedback on repo detection

- isGitRepo: warn at most once per session when recovering a repo via
  the .git marker, so a broken-git scan can't flood main-process logs.
- repo-detection test: delete PATH instead of assigning "undefined" when
  it was originally unset, avoiding a corrupted PATH for later tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: harden git repo marker fallback

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Omar Shahine <10343873+omarshahine@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
2026-07-01 15:10:35 -07:00
..
cli Per-Workspace Environments (on-demand disposable runtimes) + Add Project remote host setup (#6320) 2026-06-30 11:31:55 -07:00
main fix: detect valid repos when git rev-parse can't confirm (#6173) 2026-07-01 15:10:35 -07:00
preload Fix terminal switch input lag from daemon session listing (#7002) 2026-07-01 13:19:50 -07:00
relay Make remote SSH terminals persistent by default (#6955) 2026-06-30 16:16:10 -07:00
renderer Fix Resource Manager session polling lag (#7050) 2026-07-01 15:06:31 -07:00
shared fix: reordered default columns in kanban board (#6934) 2026-07-01 13:17:52 -07:00
types