zsh completion: find matching custom bash completion
authorRamkumar Ramachandra <artagnon@gmail.com>
Sun, 5 Jan 2014 10:18:02 +0000 (15:48 +0530)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Jan 2014 17:14:29 +0000 (09:14 -0800)
If zsh completion is being read from a location that is different from
system-wide default, it is likely that the user is trying to use a
custom version, perhaps closer to the bleeding edge, installed in her
own directory. We will more likely to find the matching bash completion
script in the same directory than in those system default places.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.zsh
index fac5e711ebbbd074366d89848165e0f9dbc36c36..6fca145c06d49ac9a4a23aac3cf1ec6e8ec2eef8 100644 (file)
@@ -30,10 +30,10 @@ if [ -z "$script" ]; then
        local -a locations
        local e
        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
-               $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
                )
        for e in $locations; do
                test -f $e && script="$e" && break