{"thread":{"id":"33928","subject":"[PATCH] completion: zsh: improve bash script loading","startedAt":"2013-05-25T03:31:44Z","lastAt":"2013-05-25T03:31:44Z","messageCount":1,"participants":["Felipe Contreras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"218500","messageId":"1369452704-5974-1-git-send-email-felipe.contreras@gmail.com","threadId":"33928","inReplyTo":null,"subject":"[PATCH] completion: zsh: improve bash script loading","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-25T03:31:44Z","receivedAt":"2013-05-25T03:31:44Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"It's better to check in multiple locations, so the user doesn't have to.\n\nAnd update the documentation.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 26 ++++++++++++++++++--------\n 1 file changed, 18 insertions(+), 8 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 2565d2e..9555cf8 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -4,18 +4,17 @@\n #\n # Copyright (c) 2012-2013 Felipe Contreras <felipe.contreras@gmail.com>\n #\n-# You need git's bash completion script installed somewhere, by default on the\n-# same directory as this script.\n+# You need git's bash completion script installed somewhere, by default it\n+# would be the location bash-completion uses.\n #\n-# If your script is on ~/.git-completion.sh instead, you can configure it on\n-# your ~/.zshrc:\n+# If your script is somewhere else, you can configure it on your ~/.zshrc:\n #\n #  zstyle ':completion:*:*:git:*' script ~/.git-completion.sh\n #\n-# The recommended way to install this script is to copy to\n-# '~/.zsh/completion/_git', and then add the following to your ~/.zshrc file:\n+# The recommended way to install this script is to copy to '~/.zsh/_git', and\n+# then add the following to your ~/.zshrc file:\n #\n-#  fpath=(~/.zsh/completion $fpath)\n+#  fpath=(~/.zsh $fpath)\n \n complete ()\n {\n@@ -27,7 +26,18 @@ zstyle -T ':completion:*:*:git:*' tag-order && \\\n \tzstyle ':completion:*:*:git:*' tag-order 'common-commands'\n \n zstyle -s \":completion:*:*:git:*\" script script\n-test -z \"$script\" && script=\"$(dirname ${funcsourcetrace[1]%:*})\"/git-completion.bash\n+if [ -z \"$script\" ]; then\n+\tlocal -a locations\n+\tlocations=(\n+\t\t'/etc/bash_completion.d/git' # fedora, old debian\n+\t\t'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian\n+\t\t'/usr/share/bash-completion/git' # gentoo\n+\t\t$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash\n+\t\t)\n+\tfor e in $locations; do\n+\t\ttest -f $e && script=\"$e\" && break\n+\tdone\n+fi\n ZSH_VERSION='' . \"$script\"\n \n __gitcomp ()\n-- \n1.8.3.rc3.312.g47657de\n"}]}