Skip to content

Commit 98fc268

Browse files
felipecgitster
authored andcommitted
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>
1 parent 44b37ab commit 98fc268

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

contrib/completion/git-completion.zsh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# fpath=(~/.zsh $fpath)
1414
#
1515
# You need git's bash completion script installed. By default bash-completion's
16-
# location will be used (e.g. /usr/share/bash-completion/completions/git).
16+
# location will be used (e.g. pkg-config --variable=completionsdir bash-completion).
1717
#
1818
# If your bash completion script is somewhere else, you can specify the
1919
# location in your ~/.zshrc:
@@ -33,12 +33,16 @@ zstyle -T ':completion:*:*:git:*' tag-order && \
3333
zstyle -s ":completion:*:*:git:*" script script
3434
if [ -z "$script" ]; then
3535
local -a locations
36-
local e
36+
local e bash_completion
37+
38+
bash_completion=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null) ||
39+
bash_completion='/usr/share/bash-completion/completions/'
40+
3741
locations=(
3842
"$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
39-
'/etc/bash_completion.d/git' # fedora, old debian
40-
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
41-
'/usr/share/bash-completion/git' # gentoo
43+
"$HOME/.local/share/bash-completion/completions/git"
44+
"$bash_completion/git"
45+
'/etc/bash_completion.d/git' # old debian
4246
)
4347
for e in $locations; do
4448
test -f $e && script="$e" && break

0 commit comments

Comments
 (0)