{"thread":{"id":"33965","subject":"[PATCH] completion: zsh: improve bash script loading","startedAt":"2013-05-29T03:24:00Z","lastAt":"2013-05-29T19:58:10Z","messageCount":6,"participants":["Felipe Contreras","Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"218724","messageId":"1369797840-3103-1-git-send-email-felipe.contreras@gmail.com","threadId":"33965","inReplyTo":null,"subject":"[PATCH] completion: zsh: improve bash script loading","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T03:24:00Z","receivedAt":"2013-05-29T03:24:00Z","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"},{"id":"218762","messageId":"51A59D8E.1040502@viscovery.net","threadId":"33965","inReplyTo":"1369797840-3103-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH] completion: zsh: improve bash script loading","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-05-29T06:17:50Z","receivedAt":"2013-05-29T06:17:50Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 5/29/2013 5:24, schrieb Felipe Contreras:\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\nWon't you need\n\n\tlocal e\n\nhere, or does it not matter?\n\n> +\tfor e in $locations; do\n> +\t\ttest -f $e && script=\"$e\" && break\n> +\tdone\n> +fi\n\n-- Hannes\n"},{"id":"218765","messageId":"CAMP44s1UwYxS_sZSKTyEj5rhmrJ4gFkPc9z+eCL6WAaHXkY8eQ@mail.gmail.com","threadId":"33965","inReplyTo":"51A59D8E.1040502@viscovery.net","subject":"Re: [PATCH] completion: zsh: improve bash script loading","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T06:30:48Z","receivedAt":"2013-05-29T06:30:48Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, May 29, 2013 at 1:17 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Am 5/29/2013 5:24, schrieb Felipe Contreras:\n>> +if [ -z \"$script\" ]; then\n>> +     local -a locations\n>> +     locations=(\n>> +             '/etc/bash_completion.d/git' # fedora, old debian\n>> +             '/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian\n>> +             '/usr/share/bash-completion/git' # gentoo\n>> +             $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash\n>> +             )\n>\n> Won't you need\n>\n>         local e\n>\n> here, or does it not matter?\n\nYou are right, otherwise it would be in the user's shell.\n\n-- \nFelipe Contreras\n"},{"id":"218863","messageId":"7vr4gpu15c.fsf@alter.siamese.dyndns.org","threadId":"33965","inReplyTo":"CAMP44s1UwYxS_sZSKTyEj5rhmrJ4gFkPc9z+eCL6WAaHXkY8eQ@mail.gmail.com","subject":"Re: [PATCH] completion: zsh: improve bash script loading","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-29T17:49:35Z","receivedAt":"2013-05-29T17:49:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> On Wed, May 29, 2013 at 1:17 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>> Am 5/29/2013 5:24, schrieb Felipe Contreras:\n>>> +if [ -z \"$script\" ]; then\n>>> +     local -a locations\n>>> +     locations=(\n>>> +             '/etc/bash_completion.d/git' # fedora, old debian\n>>> +             '/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian\n>>> +             '/usr/share/bash-completion/git' # gentoo\n>>> +             $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash\n>>> +             )\n>>\n>> Won't you need\n>>\n>>         local e\n>>\n>> here, or does it not matter?\n>\n> You are right, otherwise it would be in the user's shell.\n\nHas this changed since 0a04e187e669 (completion: zsh: improve bash\nscript loading, 2013-05-24) which I have on 'pu'?\n\nIf not, I can do this locally to save a roundtrip, if you want.\n\n contrib/completion/git-completion.zsh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 9555cf8..fac5e71 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -28,6 +28,7 @@ zstyle -T ':completion:*:*:git:*' tag-order && \\\n zstyle -s \":completion:*:*:git:*\" script script\n if [ -z \"$script\" ]; then\n \tlocal -a locations\n+\tlocal e\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"},{"id":"218884","messageId":"CAMP44s0VjXwOXhUvniui+yVJiH4Dwxtx=0431G2KrEdHtrGTDw@mail.gmail.com","threadId":"33965","inReplyTo":"7vr4gpu15c.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] completion: zsh: improve bash script loading","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-29T19:30:42Z","receivedAt":"2013-05-29T19:30:42Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, May 29, 2013 at 12:49 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>\n>> On Wed, May 29, 2013 at 1:17 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>>> Am 5/29/2013 5:24, schrieb Felipe Contreras:\n>>>> +if [ -z \"$script\" ]; then\n>>>> +     local -a locations\n>>>> +     locations=(\n>>>> +             '/etc/bash_completion.d/git' # fedora, old debian\n>>>> +             '/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian\n>>>> +             '/usr/share/bash-completion/git' # gentoo\n>>>> +             $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash\n>>>> +             )\n>>>\n>>> Won't you need\n>>>\n>>>         local e\n>>>\n>>> here, or does it not matter?\n>>\n>> You are right, otherwise it would be in the user's shell.\n>\n> Has this changed since 0a04e187e669 (completion: zsh: improve bash\n> script loading, 2013-05-24) which I have on 'pu'?\n\nOther than this change, nope.\n\n> If not, I can do this locally to save a roundtrip, if you want.\n\nGreat, let's do that.\n\n-- \nFelipe Contreras\n"},{"id":"218891","messageId":"7vbo7tsgml.fsf@alter.siamese.dyndns.org","threadId":"33965","inReplyTo":"CAMP44s0VjXwOXhUvniui+yVJiH4Dwxtx=0431G2KrEdHtrGTDw@mail.gmail.com","subject":"Re: [PATCH] completion: zsh: improve bash script loading","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-29T19:58:10Z","receivedAt":"2013-05-29T19:58:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n>> Has this changed since 0a04e187e669 (completion: zsh: improve bash\n>> script loading, 2013-05-24) which I have on 'pu'?\n>\n> Other than this change, nope.\n>\n>> If not, I can do this locally to save a roundtrip, if you want.\n>\n> Great, let's do that.\n\nDone.  The diff from 0a04e187e669 looks like this:\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 9555cf8..fac5e71 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -28,6 +28,7 @@ zstyle -T ':completion:*:*:git:*' tag-order && \\\n zstyle -s \":completion:*:*:git:*\" script script\n if [ -z \"$script\" ]; then\n \tlocal -a locations\n+\tlocal e\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"}]}