fix(config): skip local config when git rev-parse fails

Description

What does this MR do and why?

When git rev-parse fails at a worktree or submodule root, glab now falls back to global config instead of erroring with "remove or rename regular file .git".

Before: Every glab command failed with an unhelpful error message telling users to delete their .git file (which would break the worktree).

After: glab skips local config and uses global config, the same behavior as running outside a repository.

Closes #8690 (closed)

How to set up and validate locally

go build -o /tmp/glab ./cmd/glab
mkdir -p /tmp/repro/main && cd /tmp/repro/main
git init -q . && git commit -q --allow-empty -m init
git worktree add -q --detach ../wt
cd .. && mv main main-moved
cd wt
/tmp/glab config get editor   # should succeed silently, not error

MR acceptance checklist

  • Tests added for the new behavior
  • Existing tests updated for changed function signatures
  • Verified end-to-end locally

Screenshots (if appropriate):

NA

Merge request reports

Loading
Loading