mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
is_git_repo() used `git rev-parse --show-toplevel` to detect whether the current directory is inside a git repository. --show-toplevel fails for bare repositories since they have no working tree, so every command that relies on this shared helper (e.g. `git browse`) reports "Not a git repo!" when run from inside a bare repo, even though it plainly is one. Switch to `git rev-parse --git-dir`, which succeeds for both normal and bare repositories and keeps the existing "not a repo" behavior for non-repo directories. Fixes #1238, reported and LGTM'd by maintainers there with this exact fix; no PR had been opened for it yet. Adds tests/is-git-repo.bats covering: a normal repo, a bare repo, and a plain (non-repo) directory. |
||
|---|---|---|
| .. | ||
| git-extra-utility | ||
| has-git-commit | ||
| is-git-repo | ||
| reset-env | ||