[completions/git] Skip bare repositories

Otherwise this would print an unsightly error.
This commit is contained in:
Fabian Homborg 2018-09-27 13:08:56 +02:00
parent 6c1ea03e9c
commit 3b3361685a

View File

@ -85,9 +85,14 @@ function __fish_git_files
# to get _all_ kinds of staged files.
# Save the repo root to remove it from the path later.
set -l root (command git rev-parse --show-toplevel 2>/dev/null)
set -l root (command git rev-parse --show-toplevel --is-bare-repository 2>/dev/null)
or return
# Skip bare repositories.
test "$root[2]" = "true"
and return
or set -e root[2]
# Cache the translated descriptions so we don't have to get it
# once per file.
contains -- unmerged $argv; and set -l unmerged