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.pull/685/head
parent
b1b10c333d
commit
0a32584476
@ -1,3 +1,7 @@
|
|||||||
function git_is_repo -d "Check if directory is a repository"
|
function git_is_repo -d "Check if directory is a repository"
|
||||||
test -d .git; or command git rev-parse --git-dir >/dev/null 2> /dev/null
|
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
|
end
|
||||||
|
Loading…
Reference in New Issue