oh-my-fish/lib/git/git_is_repo.fish
Johannes Altmanninger 0a32584476 Fix error when inside a bare git repository
For example, "git diff" would print
"fatal: this operation must be run in a work tree"

We could still run git_branch_name in bare repositories in future.
2020-12-01 01:47:35 -08:00

8 lines
210 B
Fish

function git_is_repo -d "Check if directory is a repository"
test -d .git
or begin
set -l info (command git rev-parse --git-dir --is-bare-repository 2>/dev/null)
and test $info[2] = false
end
end