{"thread":{"id":"54520","subject":"[PATCH v3 13/29] completion: zsh: add missing direct_append","startedAt":"2020-10-28T21:44:35Z","lastAt":"2020-10-29T17:43:53Z","messageCount":31,"participants":["Felipe Contreras","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":29},"messages":[{"id":"408553","messageId":"20201028020712.442623-14-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 13/29] completion: zsh: add missing direct_append","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:56Z","receivedAt":"2020-10-28T21:44:35Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Commit 688077910b forgot to add the corresponding zsh function.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex b894cb52db..c5b875993f 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -105,6 +105,11 @@ __gitcomp_direct ()\n \tcompadd -Q -- ${${=1}% } && _ret=0\n }\n \n+__gitcomp_direct_append ()\n+{\n+\t__gitcomp_direct \"$@\"\n+}\n+\n __gitcomp_nl ()\n {\n \temulate -L zsh\n-- \n2.29.1\n\n"},{"id":"408558","messageId":"20201028020712.442623-11-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 10/29] completion: bash: remove zsh wrapper","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:53Z","receivedAt":"2020-10-28T21:53:40Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"It has been deprecated for more than eight years now, it's never up to\ndate, and it's a hassle to maintain.\n\nIt's time to move on.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 92 +-------------------------\n 1 file changed, 2 insertions(+), 90 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 40affd40e2..26d6ee20b0 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3458,96 +3458,8 @@ __gitk_main ()\n \t__git_complete_revlist\n }\n \n-if [[ -n ${ZSH_VERSION-} ]] &&\n-   # Don't define these functions when sourced from 'git-completion.zsh',\n-   # it has its own implementations.\n-   [[ -z ${GIT_SOURCING_ZSH_COMPLETION-} ]]; then\n-\techo \"WARNING: this script is deprecated, please see git-completion.zsh\" 1>&2\n-\n-\tautoload -U +X compinit && compinit\n-\n-\t__gitcomp ()\n-\t{\n-\t\temulate -L zsh\n-\n-\t\tlocal cur_=\"${3-$cur}\"\n-\n-\t\tcase \"$cur_\" in\n-\t\t--*=)\n-\t\t\t;;\n-\t\t*)\n-\t\t\tlocal c IFS=$' \\t\\n'\n-\t\t\tlocal -a array\n-\t\t\tfor c in ${=1}; do\n-\t\t\t\tc=\"$c${4-}\"\n-\t\t\t\tcase $c in\n-\t\t\t\t--*=*|*.) ;;\n-\t\t\t\t*) c=\"$c \" ;;\n-\t\t\t\tesac\n-\t\t\t\tarray[${#array[@]}+1]=\"$c\"\n-\t\t\tdone\n-\t\t\tcompset -P '*[=:]'\n-\t\t\tcompadd -Q -S '' -p \"${2-}\" -a -- array && _ret=0\n-\t\t\t;;\n-\t\tesac\n-\t}\n-\n-\t__gitcomp_direct ()\n-\t{\n-\t\temulate -L zsh\n-\n-\t\tlocal IFS=$'\\n'\n-\t\tcompset -P '*[=:]'\n-\t\tcompadd -Q -- ${${=1}% } && _ret=0\n-\t}\n-\n-\t__gitcomp_nl ()\n-\t{\n-\t\temulate -L zsh\n-\n-\t\tlocal IFS=$'\\n'\n-\t\tcompset -P '*[=:]'\n-\t\tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${=1} && _ret=0\n-\t}\n-\n-\t__gitcomp_nl_append ()\n-\t{\n-\t\temulate -L zsh\n-\n-\t\tlocal IFS=$'\\n'\n-\t\tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${=1} && _ret=0\n-\t}\n-\n-\t__gitcomp_file_direct ()\n-\t{\n-\t\temulate -L zsh\n-\n-\t\tlocal IFS=$'\\n'\n-\t\tcompset -P '*[=:]'\n-\t\tcompadd -f -- ${=1} && _ret=0\n-\t}\n-\n-\t__gitcomp_file ()\n-\t{\n-\t\temulate -L zsh\n-\n-\t\tlocal IFS=$'\\n'\n-\t\tcompset -P '*[=:]'\n-\t\tcompadd -p \"${2-}\" -f -- ${=1} && _ret=0\n-\t}\n-\n-\t_git ()\n-\t{\n-\t\tlocal _ret=1 cur cword prev\n-\t\tcur=${words[CURRENT]}\n-\t\tprev=${words[CURRENT-1]}\n-\t\tlet cword=CURRENT-1\n-\t\temulate ksh -c __${service}_main\n-\t\tlet _ret && _default && _ret=0\n-\t\treturn _ret\n-\t}\n-\n-\tcompdef _git git gitk\n+if [[ -n ${ZSH_VERSION-} && -z ${GIT_SOURCING_ZSH_COMPLETION-} ]]; then\n+\techo \"ERROR: this script is obsolete, please see git-completion.zsh\" 1>&2\n \treturn\n fi\n \n-- \n2.29.1\n\n"},{"id":"408559","messageId":"20201028020712.442623-24-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 23/29] completion: zsh: add alias descriptions","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:06Z","receivedAt":"2020-10-28T21:54:23Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 22d8e58fcc..1204a55890 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -196,8 +196,9 @@ __git_zsh_cmd_common ()\n __git_zsh_cmd_alias ()\n {\n \tlocal -a list\n-\tlist=(${${${(0)\"$(git config -z --get-regexp '^alias\\.')\"}#alias.}%$'\\n'*})\n-\t_describe -t alias-commands 'aliases' list $* && _ret=0\n+\tlist=(${${(0)\"$(git config -z --get-regexp '^alias\\.*')\"}#alias.})\n+\tlist=(${(f)\"$(printf \"%s:alias for '%s'\\n\" ${(f@)list})\"})\n+\t_describe -t alias-commands 'aliases' list && _ret=0\n }\n \n __git_zsh_cmd_all ()\n-- \n2.29.1\n\n"},{"id":"408560","messageId":"20201028020712.442623-26-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 25/29] completion: zsh: add simple version check","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:08Z","receivedAt":"2020-10-28T21:58:35Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"A lot of people are confused about which completion script they are\nusing; Zsh's Git script, or Git's Zsh script.\n\nAdd a simple helper so they can type 'git zsh<tab>' and find out if they\nare running the correct one: this.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 2956b9d0d8..811d77cb95 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -134,6 +134,11 @@ __gitcomp_file_direct ()\n \t__gitcomp_file \"$1\" \"\"\n }\n \n+_git_zsh ()\n+{\n+\t__gitcomp \"v1.1\"\n+}\n+\n __git_complete_command ()\n {\n \temulate -L zsh\n-- \n2.29.1\n\n"},{"id":"408564","messageId":"20201028020712.442623-1-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":null,"subject":"[PATCH v3 00/29] completion: zsh: latest patches","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:43Z","receivedAt":"2020-10-28T22:14:57Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Hi,\n\nI've been carrying around these patches for quite some time, many have already\nbeen sent, others I refactored to make them more clear.\n\nThese patches correspond to version 1.1 of git-completion:\n\nhttps://github.com/felipec/git-completion\n\nChanges since v2:\n\n * Silenced pkg-config command in case of errors\n * Improved loading of bash script so it's backwards compatible\n\nCheers.\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 26538efb80..49a6ef4236 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3474,7 +3474,6 @@ __git_func_wrap ()\n # This is NOT a public function; use at your own risk.\n __git_complete ()\n {\n-\ttest -n \"$ZSH_VERSION\" && return\n \tlocal wrapper=\"__git_wrap${2}\"\n \teval \"$wrapper () { __git_func_wrap $2 ; }\"\n \tcomplete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \\\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex d25f8691ef..e0fda27f4c 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -27,19 +27,26 @@ 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+\tlocal e bash_completion\n+\n+\tbash_completion=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null) ||\n+\t\tbash_completion='/usr/share/bash-completion/completions/'\n+\n \tlocations=(\n \t\t\"$(dirname ${funcsourcetrace[1]%:*})\"/git-completion.bash\n \t\t\"$HOME/.local/share/bash-completion/completions/git\"\n-\t\t\"$(pkg-config --variable=completionsdir bash-completion)\"/git\n-\t\t'/usr/share/bash-completion/completions/git'\n+\t\t\"$bash_completion/git\"\n \t\t'/etc/bash_completion.d/git' # old debian\n \t\t)\n \tfor e in $locations; do\n \t\ttest -f $e && script=\"$e\" && break\n \tdone\n fi\n+\n+local old_complete=\"$functions[complete]\"\n+functions[complete]=:\n GIT_SOURCING_ZSH_COMPLETION=y . \"$script\"\n+functions[complete]=\"$old_complete\"\n \n __gitcomp ()\n {\n@@ -129,7 +136,7 @@ __gitcomp_file_direct ()\n \n _git_zsh ()\n {\n-\t__gitcomp \"v1.0\"\n+\t__gitcomp \"v1.1\"\n }\n \n __git_complete_command ()\n\n\nFelipe Contreras (29):\n  completion: zsh: fix __gitcomp_direct()\n  completion: zsh: fix name due to broken autoloading\n  completion: zsh: fix bash script extension\n  completion: zsh: reorganize install instructions\n  completion: zsh: fix for directories with spaces\n  completion: zsh: update slave script locations\n  completion: prompt: fix color for Zsh\n  completion: zsh: fix for command aliasing\n  completion: bash: synchronize zsh wrapper\n  completion: bash: remove zsh wrapper\n  completion: zsh: fix completion for --no-.. options\n  completion: fix conflict with bashcomp\n  completion: zsh: add missing direct_append\n  completion: zsh: fix splitting of words\n  completion: zsh: simplify compadd functions\n  completion: zsh: simplify direct compadd\n  completion: zsh: trivial cleanup\n  completion: zsh: simplify nl_append\n  completion: zsh: simplify file_direct\n  completion: zsh: shuffle functions around\n  completion: zsh: refactor command completion\n  completion: zsh: improve command tags\n  completion: zsh: add alias descriptions\n  completion: zsh: trivial simplification\n  completion: zsh: add simple version check\n  completion: bash: trivial cleanup\n  completion: bash: cleanup cygwin check\n  completion: bash: remove old compat wrappers\n  Update copyright notices\n\n contrib/completion/git-completion.bash | 113 ++------------------\n contrib/completion/git-completion.zsh  | 141 ++++++++++++++++---------\n contrib/completion/git-prompt.sh       |  11 +-\n t/t9902-completion.sh                  |   2 +-\n 4 files changed, 112 insertions(+), 155 deletions(-)\n\n-- \n2.29.1\n\n"},{"id":"408567","messageId":"20201028020712.442623-10-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 09/29] completion: bash: synchronize zsh wrapper","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:52Z","receivedAt":"2020-10-28T22:26:44Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"A function was missing.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex ec7dd12a41..40affd40e2 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3510,6 +3510,14 @@ if [[ -n ${ZSH_VERSION-} ]] &&\n \t\tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${=1} && _ret=0\n \t}\n \n+\t__gitcomp_nl_append ()\n+\t{\n+\t\temulate -L zsh\n+\n+\t\tlocal IFS=$'\\n'\n+\t\tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${=1} && _ret=0\n+\t}\n+\n \t__gitcomp_file_direct ()\n \t{\n \t\temulate -L zsh\n-- \n2.29.1\n\n"},{"id":"408569","messageId":"20201028020712.442623-15-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 14/29] completion: zsh: fix splitting of words","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:57Z","receivedAt":"2020-10-28T22:36:44Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Files don't need to be split by '=:', words do.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex c5b875993f..d9ce5e1742 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -124,6 +124,7 @@ __gitcomp_nl_append ()\n \temulate -L zsh\n \n \tlocal IFS=$'\\n'\n+\tcompset -P '*[=:]'\n \tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${=1} && _ret=0\n }\n \n@@ -132,7 +133,6 @@ __gitcomp_file_direct ()\n \temulate -L zsh\n \n \tlocal IFS=$'\\n'\n-\tcompset -P '*[=:]'\n \tcompadd -f -- ${=1} && _ret=0\n }\n \n@@ -141,7 +141,6 @@ __gitcomp_file ()\n \temulate -L zsh\n \n \tlocal IFS=$'\\n'\n-\tcompset -P '*[=:]'\n \tcompadd -p \"${2-}\" -f -- ${=1} && _ret=0\n }\n \n-- \n2.29.1\n\n"},{"id":"408580","messageId":"20201028020712.442623-30-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 29/29] Update copyright notices","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:12Z","receivedAt":"2020-10-28T23:14:21Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 2 +-\n t/t9902-completion.sh                 | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 811d77cb95..e0fda27f4c 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -2,7 +2,7 @@\n \n # zsh completion wrapper for git\n #\n-# Copyright (c) 2012-2013 Felipe Contreras <felipe.contreras@gmail.com>\n+# Copyright (c) 2012-2020 Felipe Contreras <felipe.contreras@gmail.com>\n #\n # The recommended way to install this script is to make a copy of it as a\n # file named '_git' inside any directory in your fpath.\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 7b7bc6e4bd..caf4e9101f 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -1,6 +1,6 @@\n #!/bin/sh\n #\n-# Copyright (c) 2012 Felipe Contreras\n+# Copyright (c) 2012-2020 Felipe Contreras\n #\n \n test_description='test bash completion'\n-- \n2.29.1\n\n"},{"id":"408583","messageId":"20201028020712.442623-3-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 02/29] completion: zsh: fix name due to broken autoloading","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:45Z","receivedAt":"2020-10-28T23:23:37Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Commit 176f5adfdb wrongly changed the installation path to\n'~/.zsh/git-completion.zsh', this ensures the script is not\nautomatically loaded.\n\nThe whole point of adding the script to the fpath variable is that it's\nautoloaded after typing 'git<tab>', which won't happen unless it's named\n_git.\n\nI've changed the wording so it's crystal clear the name of the file\n*must* be '_git'.\n\nhttp://zsh.sourceforge.net/Doc/Release/Completion-System.html#Autoloaded-files\n\nCc: Maxim Belsky <public.belsky@gmail.com>\nCc: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 2cefae943a..6d451355fd 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -11,9 +11,11 @@\n #\n #  zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh\n #\n-# The recommended way to install this script is to make a copy of it in\n-# ~/.zsh/ directory as ~/.zsh/git-completion.zsh and then add the following\n-# to your ~/.zshrc file:\n+# The recommended way to install this script is to make a copy of it as a\n+# file named '_git' inside any directory in your fpath.\n+#\n+# For example, create a directory '~/.zsh/', copy this file to '~/.zsh/_git',\n+# and then add the following to your ~/.zshrc file:\n #\n #  fpath=(~/.zsh $fpath)\n \n-- \n2.29.1\n\n"},{"id":"408585","messageId":"20201028020712.442623-12-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 11/29] completion: zsh: fix completion for --no-.. options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:54Z","receivedAt":"2020-10-28T23:28:59Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"This was introduced in upstream's bash script, but never in zsh's:\n\n  b221b5ab9b (completion: collapse extra --no-.. options)\n\nIt has been failing since v2.19.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 22 ++++++++++++++++++++++\n 1 file changed, 22 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex f524c6042a..e567062505 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -59,10 +59,32 @@ __gitcomp ()\n \tcase \"$cur_\" in\n \t--*=)\n \t\t;;\n+\t--no-*)\n+\t\tlocal c IFS=$' \\t\\n'\n+\t\tlocal -a array\n+\t\tfor c in ${=1}; do\n+\t\t\tif [[ $c == \"--\" ]]; then\n+\t\t\t\tcontinue\n+\t\t\tfi\n+\t\t\tc=\"$c${4-}\"\n+\t\t\tcase $c in\n+\t\t\t--*=|*.) ;;\n+\t\t\t*) c=\"$c \" ;;\n+\t\t\tesac\n+\t\t\tarray+=(\"$c\")\n+\t\tdone\n+\t\tcompset -P '*[=:]'\n+\t\tcompadd -Q -S '' -p \"${2-}\" -a -- array && _ret=0\n+\t\t;;\n \t*)\n \t\tlocal c IFS=$' \\t\\n'\n \t\tlocal -a array\n \t\tfor c in ${=1}; do\n+\t\t\tif [[ $c == \"--\" ]]; then\n+\t\t\t\tc=\"--no-...${4-}\"\n+\t\t\t\tarray+=(\"$c \")\n+\t\t\t\tbreak\n+\t\t\tfi\n \t\t\tc=\"$c${4-}\"\n \t\t\tcase $c in\n \t\t\t--*=*|*.) ;;\n-- \n2.29.1\n\n"},{"id":"408586","messageId":"20201028020712.442623-13-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 12/29] completion: fix conflict with bashcomp","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:55Z","receivedAt":"2020-10-28T23:29:00Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"We don't want to override the 'complete()' function in zsh, which can be\nused by bashcomp.\n\nReported-by: Mark Lodato <lodato@google.com>\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 10 ++++------\n 1 file changed, 4 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex e567062505..b894cb52db 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -21,12 +21,6 @@\n #  zstyle ':completion:*:*:git:*' script ~/.git-completion.bash\n #\n \n-complete ()\n-{\n-\t# do nothing\n-\treturn 0\n-}\n-\n zstyle -T ':completion:*:*:git:*' tag-order && \\\n \tzstyle ':completion:*:*:git:*' tag-order 'common-commands'\n \n@@ -48,7 +42,11 @@ if [ -z \"$script\" ]; then\n \t\ttest -f $e && script=\"$e\" && break\n \tdone\n fi\n+\n+local old_complete=\"$functions[complete]\"\n+functions[complete]=:\n GIT_SOURCING_ZSH_COMPLETION=y . \"$script\"\n+functions[complete]=\"$old_complete\"\n \n __gitcomp ()\n {\n-- \n2.29.1\n\n"},{"id":"408588","messageId":"20201028020712.442623-18-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 17/29] completion: zsh: trivial cleanup","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:00Z","receivedAt":"2020-10-28T23:36:55Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 3689bcbd6c..234e4278a2 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -136,7 +136,7 @@ __gitcomp_file ()\n {\n \temulate -L zsh\n \n-\tcompadd -p \"${2-}\" -f -- ${(f)1} && _ret=0\n+\tcompadd -f -p \"${2-}\" -- ${(f)1} && _ret=0\n }\n \n __git_zsh_bash_func ()\n-- \n2.29.1\n\n"},{"id":"408589","messageId":"20201028020712.442623-17-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 16/29] completion: zsh: simplify direct compadd","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:59Z","receivedAt":"2020-10-28T23:42:23Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Instead of manually removing the suffix so zsh can add its own, we can\ntell zsh to add no suffix, so we don't have to remove it.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 1ef02f936c..3689bcbd6c 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -101,7 +101,7 @@ __gitcomp_direct ()\n \temulate -L zsh\n \n \tcompset -P '*[=:]'\n-\tcompadd -Q -- ${${(f)1}% } && _ret=0\n+\tcompadd -Q -S '' -- ${(f)1} && _ret=0\n }\n \n __gitcomp_direct_append ()\n-- \n2.29.1\n\n"},{"id":"408590","messageId":"20201028020712.442623-8-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 07/29] completion: prompt: fix color for Zsh","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:50Z","receivedAt":"2020-10-28T23:43:03Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"We don't need PROMPT_COMMAND in Zsh; we are already using %F{color} %f,\nwhich in turn use %{ and %}, which are the equivalent of Bash's\n\\[ and \\].\n\nWe can use as many colors as we want and output directly into PS1\n(or RPS1) without the risk of buffer wrapping issues.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-prompt.sh | 11 +++++++----\n 1 file changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex 16260bab73..54e123d632 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -97,7 +97,8 @@\n # If you would like a colored hint about the current dirty state, set\n # GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on\n # the colored output of \"git status -sb\" and are available only when\n-# using __git_ps1 for PROMPT_COMMAND or precmd.\n+# using __git_ps1 for PROMPT_COMMAND or precmd in Bash,\n+# but always available in Zsh.\n #\n # If you would like __git_ps1 to do nothing in the case when the current\n # directory is set up to be ignored by git, then set\n@@ -553,9 +554,11 @@ __git_ps1 ()\n \n \tlocal z=\"${GIT_PS1_STATESEPARATOR-\" \"}\"\n \n-\t# NO color option unless in PROMPT_COMMAND mode\n-\tif [ $pcmode = yes ] && [ -n \"${GIT_PS1_SHOWCOLORHINTS-}\" ]; then\n-\t\t__git_ps1_colorize_gitstring\n+\t# NO color option unless in PROMPT_COMMAND mode or it's Zsh\n+\tif [ -n \"${GIT_PS1_SHOWCOLORHINTS-}\" ]; then\n+\t\tif [ $pcmode = yes ] || [ -n \"${ZSH_VERSION-}\" ]; then\n+\t\t\t__git_ps1_colorize_gitstring\n+\t\tfi\n \tfi\n \n \tb=${b##refs/heads/}\n-- \n2.29.1\n\n"},{"id":"408591","messageId":"20201028020712.442623-29-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 28/29] completion: bash: remove old compat wrappers","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:11Z","receivedAt":"2020-10-28T23:43:15Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"It's been eight years, more than enough time to move on.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 12 ------------\n 1 file changed, 12 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 980ce73b0f..49a6ef4236 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3480,18 +3480,6 @@ __git_complete ()\n \t\t|| complete -o default -o nospace -F $wrapper $1\n }\n \n-# wrapper for backwards compatibility\n-_git ()\n-{\n-\t__git_wrap__git_main\n-}\n-\n-# wrapper for backwards compatibility\n-_gitk ()\n-{\n-\t__git_wrap__gitk_main\n-}\n-\n __git_complete git __git_main\n __git_complete gitk __gitk_main\n \n-- \n2.29.1\n\n"},{"id":"408593","messageId":"20201028020712.442623-2-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 01/29] completion: zsh: fix __gitcomp_direct()","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:44Z","receivedAt":"2020-10-28T23:46:12Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Many callers append a space suffix, but zsh automatically appends a\nspace, making the completion add two spaces, for example:\n\n  git log ma<tab>\n\nWill complete 'master  '.\n\nLet's remove that extra space.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 2 +-\n contrib/completion/git-completion.zsh  | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 0a96ad87e7..ec7dd12a41 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3498,7 +3498,7 @@ if [[ -n ${ZSH_VERSION-} ]] &&\n \n \t\tlocal IFS=$'\\n'\n \t\tcompset -P '*[=:]'\n-\t\tcompadd -Q -- ${=1} && _ret=0\n+\t\tcompadd -Q -- ${${=1}% } && _ret=0\n \t}\n \n \t__gitcomp_nl ()\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex ce47e86b60..2cefae943a 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -74,7 +74,7 @@ __gitcomp_direct ()\n \n \tlocal IFS=$'\\n'\n \tcompset -P '*[=:]'\n-\tcompadd -Q -- ${=1} && _ret=0\n+\tcompadd -Q -- ${${=1}% } && _ret=0\n }\n \n __gitcomp_nl ()\n-- \n2.29.1\n\n"},{"id":"408595","messageId":"20201028020712.442623-21-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 20/29] completion: zsh: shuffle functions around","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:03Z","receivedAt":"2020-10-28T23:56:04Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Just to have a nice order.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 24 ++++++++++++------------\n 1 file changed, 12 insertions(+), 12 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 4834ebc889..60efddb4a9 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -104,11 +104,6 @@ __gitcomp_direct ()\n \tcompadd -Q -S '' -- ${(f)1} && _ret=0\n }\n \n-__gitcomp_direct_append ()\n-{\n-\t__gitcomp_direct \"$@\"\n-}\n-\n __gitcomp_nl ()\n {\n \temulate -L zsh\n@@ -117,21 +112,26 @@ __gitcomp_nl ()\n \tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${(f)1} && _ret=0\n }\n \n-__gitcomp_nl_append ()\n+__gitcomp_file ()\n {\n-\t__gitcomp_nl \"$@\"\n+\temulate -L zsh\n+\n+\tcompadd -f -p \"${2-}\" -- ${(f)1} && _ret=0\n }\n \n-__gitcomp_file_direct ()\n+__gitcomp_direct_append ()\n {\n-\t__gitcomp_file \"$1\" ''\n+\t__gitcomp_direct \"$@\"\n }\n \n-__gitcomp_file ()\n+__gitcomp_nl_append ()\n {\n-\temulate -L zsh\n+\t__gitcomp_nl \"$@\"\n+}\n \n-\tcompadd -f -p \"${2-}\" -- ${(f)1} && _ret=0\n+__gitcomp_file_direct ()\n+{\n+\t__gitcomp_file \"$1\" \"\"\n }\n \n __git_zsh_bash_func ()\n-- \n2.29.1\n\n"},{"id":"408596","messageId":"20201028020712.442623-22-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 21/29] completion: zsh: refactor command completion","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:04Z","receivedAt":"2020-10-29T00:00:01Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 20 ++++++++++++++++----\n 1 file changed, 16 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 60efddb4a9..858864f3fb 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -134,20 +134,32 @@ __gitcomp_file_direct ()\n \t__gitcomp_file \"$1\" \"\"\n }\n \n+__git_complete_command ()\n+{\n+\temulate -L zsh\n+\n+\tlocal command=\"$1\"\n+\tlocal completion_func=\"_git_${command//-/_}\"\n+\tif (( $+functions[$completion_func] )); then\n+\t\temulate ksh -c $completion_func\n+\t\treturn 0\n+\telse\n+\t\treturn 1\n+\tfi\n+}\n+\n __git_zsh_bash_func ()\n {\n \temulate -L ksh\n \n \tlocal command=$1\n \n-\tlocal completion_func=\"_git_${command//-/_}\"\n-\tdeclare -f $completion_func >/dev/null && $completion_func && return\n+\t__git_complete_command \"$command\" && return\n \n \tlocal expansion=$(__git_aliased_command \"$command\")\n \tif [ -n \"$expansion\" ]; then\n \t\twords[1]=$expansion\n-\t\tcompletion_func=\"_git_${expansion//-/_}\"\n-\t\tdeclare -f $completion_func >/dev/null && $completion_func\n+\t\t__git_complete_command \"$expansion\"\n \tfi\n }\n \n-- \n2.29.1\n\n"},{"id":"408597","messageId":"20201028020712.442623-9-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 08/29] completion: zsh: fix for command aliasing","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:51Z","receivedAt":"2020-10-29T00:01:59Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"A lot of people want to define aliases like gc='git commit', and zsh\nallows that (when not using 'complete_aliases'), but we need to handle\nservices that call a function other than the main one.\n\nWith this patch we can do:\n\n  compdef _git gc=git_commit\n\nAdditionally, add compatibility for Zsh Git functions which have the\nform git-commit (with dash, not underscore).\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 6 +++++-\n 1 file changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex ccf384ba35..f524c6042a 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -243,8 +243,12 @@ _git ()\n \n \tif (( $+functions[__${service}_zsh_main] )); then\n \t\t__${service}_zsh_main\n-\telse\n+\telif (( $+functions[__${service}_main] )); then\n \t\temulate ksh -c __${service}_main\n+\telif (( $+functions[_${service}] )); then\n+\t\temulate ksh -c _${service}\n+\telif ((\t$+functions[_${service//-/_}] )); then\n+\t\temulate ksh -c _${service//-/_}\n \tfi\n \n \tlet _ret && _default && _ret=0\n-- \n2.29.1\n\n"},{"id":"408598","messageId":"20201028020712.442623-4-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 03/29] completion: zsh: fix bash script extension","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:46Z","receivedAt":"2020-10-29T00:09:41Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Commit 0e5ed7cca3 wrongly changed the extension of the bash script\nto .zsh; the zstyle configuration is for the slave script (bash), not\nthe master one (zsh).\n\nFor example it could be:\n\n  zstyle ':completion:*:*:git:*' script ~/.git-completion.bash\n\nThe extension doesn't really matter, but it confuses people into\nthinking it's a zsh script; it's not.\n\nCc: Peter van der Does <peter@avirtualhome.com>\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 6d451355fd..712ce2f4d1 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -9,7 +9,7 @@\n #\n # If your script is somewhere else, you can configure it on your ~/.zshrc:\n #\n-#  zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh\n+#  zstyle ':completion:*:*:git:*' script ~/.git-completion.bash\n #\n # The recommended way to install this script is to make a copy of it as a\n # file named '_git' inside any directory in your fpath.\n-- \n2.29.1\n\n"},{"id":"408599","messageId":"20201028020712.442623-25-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 24/29] completion: zsh: trivial simplification","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:07Z","receivedAt":"2020-10-29T00:15:59Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"From upstream bash simplification:\n\n  d9ee1e0617 (completion: simplify inner 'case' pattern in __gitcomp())\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 1204a55890..2956b9d0d8 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -85,7 +85,7 @@ __gitcomp ()\n \t\t\tfi\n \t\t\tc=\"$c${4-}\"\n \t\t\tcase $c in\n-\t\t\t--*=*|*.) ;;\n+\t\t\t--*=|*.) ;;\n \t\t\t*) c=\"$c \" ;;\n \t\t\tesac\n \t\t\tarray+=(\"$c\")\n-- \n2.29.1\n\n"},{"id":"408600","messageId":"20201028020712.442623-19-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 18/29] completion: zsh: simplify nl_append","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:01Z","receivedAt":"2020-10-29T00:18:00Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"It's exactly the same as __gitcomp_nl(), no need to duplicate code.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 5 +----\n 1 file changed, 1 insertion(+), 4 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 234e4278a2..7126c75001 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -119,10 +119,7 @@ __gitcomp_nl ()\n \n __gitcomp_nl_append ()\n {\n-\temulate -L zsh\n-\n-\tcompset -P '*[=:]'\n-\tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${(f)1} && _ret=0\n+\t__gitcomp_nl \"$@\"\n }\n \n __gitcomp_file_direct ()\n-- \n2.29.1\n\n"},{"id":"408601","messageId":"20201028020712.442623-28-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 27/29] completion: bash: cleanup cygwin check","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:10Z","receivedAt":"2020-10-29T00:21:10Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Avoid Yoda conditions, and use $OSTYPE.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex ed059f35c3..980ce73b0f 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3499,6 +3499,6 @@ __git_complete gitk __gitk_main\n # when the user has tab-completed the executable name and consequently\n # included the '.exe' suffix.\n #\n-if [ Cygwin = \"$(uname -o 2>/dev/null)\" ]; then\n-__git_complete git.exe __git_main\n+if [ \"$OSTYPE\" = cygwin ]; then\n+\t__git_complete git.exe __git_main\n fi\n-- \n2.29.1\n\n"},{"id":"408603","messageId":"20201028020712.442623-27-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 26/29] completion: bash: trivial cleanup","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:09Z","receivedAt":"2020-10-29T00:23:38Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"There's no need to set a variable we are not going to use.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 13 ++++++-------\n 1 file changed, 6 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 26d6ee20b0..ed059f35c3 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -416,14 +416,13 @@ __gitcomp_builtin ()\n \tlocal options\n \teval \"options=\\${$var-}\"\n \n-\tlocal completion_helper\n-\tif [ \"$GIT_COMPLETION_SHOW_ALL\" = \"1\" ]; then\n-\t\tcompletion_helper=\"--git-completion-helper-all\"\n-\telse\n-\t\tcompletion_helper=\"--git-completion-helper\"\n-\tfi\n-\n \tif [ -z \"$options\" ]; then\n+\t\tlocal completion_helper\n+\t\tif [ \"$GIT_COMPLETION_SHOW_ALL\" = \"1\" ]; then\n+\t\t\tcompletion_helper=\"--git-completion-helper-all\"\n+\t\telse\n+\t\t\tcompletion_helper=\"--git-completion-helper\"\n+\t\tfi\n \t\t# leading and trailing spaces are significant to make\n \t\t# option removal work correctly.\n \t\toptions=\" $incl $(__git ${cmd/_/ } $completion_helper) \" || return\n-- \n2.29.1\n\n"},{"id":"408604","messageId":"20201028020712.442623-7-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 06/29] completion: zsh: update slave script locations","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:49Z","receivedAt":"2020-10-29T00:28:10Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Update the default locations of typical system bash-completion,\nincluding the default bash-completion location for user scripts, and the\nrecommended way to find the system location (with pkg-config).\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 14 +++++++++-----\n 1 file changed, 9 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 5d6740c6ff..ccf384ba35 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -13,7 +13,7 @@\n #  fpath=(~/.zsh $fpath)\n #\n # You need git's bash completion script installed. By default bash-completion's\n-# location will be used (e.g. /usr/share/bash-completion/completions/git).\n+# location will be used (e.g. pkg-config --variable=completionsdir bash-completion).\n #\n # If your bash completion script is somewhere else, you can specify the\n # location in your ~/.zshrc:\n@@ -33,12 +33,16 @@ 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+\tlocal e bash_completion\n+\n+\tbash_completion=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null) ||\n+\t\tbash_completion='/usr/share/bash-completion/completions/'\n+\n \tlocations=(\n \t\t\"$(dirname ${funcsourcetrace[1]%:*})\"/git-completion.bash\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\"$HOME/.local/share/bash-completion/completions/git\"\n+\t\t\"$bash_completion/git\"\n+\t\t'/etc/bash_completion.d/git' # old debian\n \t\t)\n \tfor e in $locations; do\n \t\ttest -f $e && script=\"$e\" && break\n-- \n2.29.1\n\n"},{"id":"408605","messageId":"20201028020712.442623-6-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 05/29] completion: zsh: fix for directories with spaces","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:48Z","receivedAt":"2020-10-29T00:34:07Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 05ccaac194..5d6740c6ff 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -35,7 +35,7 @@ if [ -z \"$script\" ]; then\n \tlocal -a locations\n \tlocal e\n \tlocations=(\n-\t\t$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash\n+\t\t\"$(dirname ${funcsourcetrace[1]%:*})\"/git-completion.bash\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-- \n2.29.1\n\n"},{"id":"408610","messageId":"20201028020712.442623-5-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 04/29] completion: zsh: reorganize install instructions","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:47Z","receivedAt":"2020-10-29T01:17:30Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Start with the most important thing; the proper location of this script,\nthen follow with the location of the slave script (git-completion.bash).\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 16 +++++++++-------\n 1 file changed, 9 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 712ce2f4d1..05ccaac194 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -4,13 +4,6 @@\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 it\n-# would be the location bash-completion uses.\n-#\n-# If your script is somewhere else, you can configure it on your ~/.zshrc:\n-#\n-#  zstyle ':completion:*:*:git:*' script ~/.git-completion.bash\n-#\n # The recommended way to install this script is to make a copy of it as a\n # file named '_git' inside any directory in your fpath.\n #\n@@ -18,6 +11,15 @@\n # and then add the following to your ~/.zshrc file:\n #\n #  fpath=(~/.zsh $fpath)\n+#\n+# You need git's bash completion script installed. By default bash-completion's\n+# location will be used (e.g. /usr/share/bash-completion/completions/git).\n+#\n+# If your bash completion script is somewhere else, you can specify the\n+# location in your ~/.zshrc:\n+#\n+#  zstyle ':completion:*:*:git:*' script ~/.git-completion.bash\n+#\n \n complete ()\n {\n-- \n2.29.1\n\n"},{"id":"408611","messageId":"20201028020712.442623-16-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 15/29] completion: zsh: simplify compadd functions","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:06:58Z","receivedAt":"2020-10-29T01:22:08Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"We don't need to override IFS, zsh has a native way of splitting by new\nlines: the expansion flag (f).\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 15 +++++----------\n 1 file changed, 5 insertions(+), 10 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex d9ce5e1742..1ef02f936c 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -100,9 +100,8 @@ __gitcomp_direct ()\n {\n \temulate -L zsh\n \n-\tlocal IFS=$'\\n'\n \tcompset -P '*[=:]'\n-\tcompadd -Q -- ${${=1}% } && _ret=0\n+\tcompadd -Q -- ${${(f)1}% } && _ret=0\n }\n \n __gitcomp_direct_append ()\n@@ -114,34 +113,30 @@ __gitcomp_nl ()\n {\n \temulate -L zsh\n \n-\tlocal IFS=$'\\n'\n \tcompset -P '*[=:]'\n-\tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${=1} && _ret=0\n+\tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${(f)1} && _ret=0\n }\n \n __gitcomp_nl_append ()\n {\n \temulate -L zsh\n \n-\tlocal IFS=$'\\n'\n \tcompset -P '*[=:]'\n-\tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${=1} && _ret=0\n+\tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${(f)1} && _ret=0\n }\n \n __gitcomp_file_direct ()\n {\n \temulate -L zsh\n \n-\tlocal IFS=$'\\n'\n-\tcompadd -f -- ${=1} && _ret=0\n+\tcompadd -f -- ${(f)1} && _ret=0\n }\n \n __gitcomp_file ()\n {\n \temulate -L zsh\n \n-\tlocal IFS=$'\\n'\n-\tcompadd -p \"${2-}\" -f -- ${=1} && _ret=0\n+\tcompadd -p \"${2-}\" -f -- ${(f)1} && _ret=0\n }\n \n __git_zsh_bash_func ()\n-- \n2.29.1\n\n"},{"id":"408616","messageId":"20201028020712.442623-23-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 22/29] completion: zsh: improve command tags","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:05Z","receivedAt":"2020-10-29T02:05:30Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"There's no need to use _alternative and repeat a lot of the code.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 11 +++++++----\n 1 file changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 858864f3fb..22d8e58fcc 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -235,10 +235,13 @@ __git_zsh_main ()\n \n \tcase $state in\n \t(command)\n-\t\t_alternative \\\n-                         'alias-commands:alias:__git_zsh_cmd_alias' \\\n-                         'common-commands:common:__git_zsh_cmd_common' \\\n-                         'all-commands:all:__git_zsh_cmd_all' && _ret=0\n+\t\t_tags common-commands alias-commands all-commands\n+\t\twhile _tags; do\n+\t\t\t_requested common-commands && __git_zsh_cmd_common\n+\t\t\t_requested alias-commands && __git_zsh_cmd_alias\n+\t\t\t_requested all-commands && __git_zsh_cmd_all\n+\t\t\tlet _ret || break\n+\t\tdone\n \t\t;;\n \t(arg)\n \t\tlocal command=\"${words[1]}\" __git_dir\n-- \n2.29.1\n\n"},{"id":"408617","messageId":"20201028020712.442623-20-felipe.contreras@gmail.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"[PATCH v3 19/29] completion: zsh: simplify file_direct","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T02:07:02Z","receivedAt":"2020-10-29T02:14:23Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"It's exactly the same as __gitcomp_file() with no prefix.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 4 +---\n 1 file changed, 1 insertion(+), 3 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 7126c75001..4834ebc889 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -124,9 +124,7 @@ __gitcomp_nl_append ()\n \n __gitcomp_file_direct ()\n {\n-\temulate -L zsh\n-\n-\tcompadd -f -- ${(f)1} && _ret=0\n+\t__gitcomp_file \"$1\" ''\n }\n \n __gitcomp_file ()\n-- \n2.29.1\n\n"},{"id":"408651","messageId":"xmqqy2jp6i87.fsf@gitster.c.googlers.com","threadId":"54520","inReplyTo":"20201028020712.442623-1-felipe.contreras@gmail.com","subject":"Re: [PATCH v3 00/29] completion: zsh: latest patches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-29T17:43:20Z","receivedAt":"2020-10-29T17:43:53Z","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> Changes since v2:\n>\n>  * Silenced pkg-config command in case of errors\n>  * Improved loading of bash script so it's backwards compatible\n\nWill replace.  Thanks.\n"}]}