aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/completion
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2020-10-27 20:06:49 -0600
committerJunio C Hamano <gitster@pobox.com>2020-10-28 14:30:59 -0700
commit98fc2684a90bfb9edaae2cb8d5129b4ca7698ddc (patch)
tree8a6b1ac9fcb20899403eeba340c59727e5b13471 /contrib/completion
parent44b37abb2aabdb49e9f44161b7eafba3f03e4da5 (diff)
downloadgit-98fc2684a90bfb9edaae2cb8d5129b4ca7698ddc.tar.gz
completion: zsh: update slave script locations
Update the default locations of typical system bash-completion, including the default bash-completion location for user scripts, and the recommended way to find the system location (with pkg-config). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion')
-rw-r--r--contrib/completion/git-completion.zsh14
1 files changed, 9 insertions, 5 deletions
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 5d6740c6ff..ccf384ba35 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -13,7 +13,7 @@
# fpath=(~/.zsh $fpath)
#
# You need git's bash completion script installed. By default bash-completion's
-# location will be used (e.g. /usr/share/bash-completion/completions/git).
+# location will be used (e.g. pkg-config --variable=completionsdir bash-completion).
#
# If your bash completion script is somewhere else, you can specify the
# location in your ~/.zshrc:
@@ -33,12 +33,16 @@ zstyle -T ':completion:*:*:git:*' tag-order && \
zstyle -s ":completion:*:*:git:*" script script
if [ -z "$script" ]; then
local -a locations
- local e
+ local e bash_completion
+
+ bash_completion=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null) ||
+ bash_completion='/usr/share/bash-completion/completions/'
+
locations=(
"$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
- '/etc/bash_completion.d/git' # fedora, old debian
- '/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
- '/usr/share/bash-completion/git' # gentoo
+ "$HOME/.local/share/bash-completion/completions/git"
+ "$bash_completion/git"
+ '/etc/bash_completion.d/git' # old debian
)
for e in $locations; do
test -f $e && script="$e" && break