only search non-system paths

pull/1635/head
cornfeedhobo 2020-08-03 14:42:52 -05:00
parent 137346974a
commit 2374f389b4
No known key found for this signature in database
GPG Key ID: 724357093F994B26
1 changed files with 10 additions and 8 deletions

View File

@ -7,17 +7,19 @@ _command_exists git || return
complete -p git &>/dev/null && return
_git_bash_completion_paths=(
# Linux
'/etc/bash_completion.d/git.sh'
'/usr/share/bash-completion/completions/git'
# MacOS
# MacOS non-system locations
'/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash'
'/Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash'
)
for fn in "${_git_bash_completion_paths[@]}" ; do
if [ -r "$fn" ] ; then
source "$fn"
break
for _comp_path in "${_git_bash_completion_paths[@]}" ; do
if [ -r "$_comp_path" ] ; then
source "$_comp_path"
unset _git_bash_completion_paths
return
fi
done
unset _git_bash_completion_paths
(_log_warning "no completion files found - please try enabling the 'system' completion instead." && return 1)