{"thread":{"id":"54499","subject":"[PATCH v2 00/29] completion: zsh: latest patches","startedAt":"2020-10-25T03:13:52Z","lastAt":"2020-10-28T22:41:46Z","messageCount":32,"participants":["Felipe Contreras","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":29},"messages":[{"id":"408305","messageId":"20201025031343.346913-1-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":null,"subject":"[PATCH v2 00/29] completion: zsh: latest patches","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:14Z","receivedAt":"2020-10-25T03:13:52Z","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\nBut what is clear is that they are needed. I see a lot of people in different\nforums (e.g. Stack Overflow, Oh-My-Zsh, etc.) getting bit by many of these\nissues.\n\nI've created an independent project to keep my sanity while maintaining these\npatches, but for what it's worth, I've transplanted them to Git upstream.\n\nhttps://github.com/felipec/git-completion\n\nThere's also a lot of information in the README apparently scattered\neverywhere, but it's good to have in one place.\n\nCheers.\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 | 114 +++------------------\n contrib/completion/git-completion.zsh  | 132 ++++++++++++++++---------\n contrib/completion/git-prompt.sh       |  11 ++-\n t/t9902-completion.sh                  |   2 +-\n 4 files changed, 105 insertions(+), 154 deletions(-)\n\n-- \n2.29.0\n\n"},{"id":"408306","messageId":"20201025031343.346913-3-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 02/29] completion: zsh: fix name due to broken autoloading","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:16Z","receivedAt":"2020-10-25T03:13:52Z","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.0\n\n"},{"id":"408307","messageId":"20201025031343.346913-2-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 01/29] completion: zsh: fix __gitcomp_direct()","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:15Z","receivedAt":"2020-10-25T03:13:52Z","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.0\n\n"},{"id":"408309","messageId":"20201025031343.346913-5-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 04/29] completion: zsh: reorganize install instructions","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:18Z","receivedAt":"2020-10-25T03:13:57Z","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.0\n\n"},{"id":"408310","messageId":"20201025031343.346913-6-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 05/29] completion: zsh: fix for directories with spaces","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:19Z","receivedAt":"2020-10-25T03:13:57Z","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.0\n\n"},{"id":"408311","messageId":"20201025031343.346913-7-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 06/29] completion: zsh: update slave script locations","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:20Z","receivedAt":"2020-10-25T03:13:59Z","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 | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 5d6740c6ff..ba41525373 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@@ -36,9 +36,10 @@ if [ -z \"$script\" ]; then\n \tlocal e\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\"$(pkg-config --variable=completionsdir bash-completion)\"/git\n+\t\t'/usr/share/bash-completion/completions/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.0\n\n"},{"id":"408312","messageId":"20201025031343.346913-8-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 07/29] completion: prompt: fix color for Zsh","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:21Z","receivedAt":"2020-10-25T03:14:04Z","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.0\n\n"},{"id":"408313","messageId":"20201025031343.346913-9-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 08/29] completion: zsh: fix for command aliasing","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:22Z","receivedAt":"2020-10-25T03:14:04Z","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 ba41525373..17041d0b23 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -240,8 +240,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.0\n\n"},{"id":"408315","messageId":"20201025031343.346913-11-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 10/29] completion: bash: remove zsh wrapper","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:24Z","receivedAt":"2020-10-25T03:14:04Z","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.0\n\n"},{"id":"408314","messageId":"20201025031343.346913-4-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 03/29] completion: zsh: fix bash script extension","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:17Z","receivedAt":"2020-10-25T03:14:05Z","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.0\n\n"},{"id":"408316","messageId":"20201025031343.346913-13-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 12/29] completion: fix conflict with bashcomp","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:26Z","receivedAt":"2020-10-25T03:14:06Z","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.bash | 1 +\n contrib/completion/git-completion.zsh  | 6 ------\n 2 files changed, 1 insertion(+), 6 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 26d6ee20b0..6de0e7b482 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3475,6 +3475,7 @@ __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 c2a90beb8b..1de9b9c80d 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-- \n2.29.0\n\n"},{"id":"408317","messageId":"20201025031343.346913-14-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 13/29] completion: zsh: add missing direct_append","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:27Z","receivedAt":"2020-10-25T03:14:07Z","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 1de9b9c80d..13c6bd5c12 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -98,6 +98,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.0\n\n"},{"id":"408318","messageId":"20201025031343.346913-17-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 16/29] completion: zsh: simplify direct compadd","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:30Z","receivedAt":"2020-10-25T03:14:13Z","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 2f20fe386a..b955404fdd 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -94,7 +94,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.0\n\n"},{"id":"408319","messageId":"20201025031343.346913-16-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 15/29] completion: zsh: simplify compadd functions","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:29Z","receivedAt":"2020-10-25T03:14:16Z","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 088bf7f759..2f20fe386a 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -93,9 +93,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@@ -107,34 +106,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.0\n\n"},{"id":"408320","messageId":"20201025031343.346913-18-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 17/29] completion: zsh: trivial cleanup","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:31Z","receivedAt":"2020-10-25T03:14:16Z","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 b955404fdd..f0babc784a 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -129,7 +129,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.0\n\n"},{"id":"408321","messageId":"20201025031343.346913-15-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 14/29] completion: zsh: fix splitting of words","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:28Z","receivedAt":"2020-10-25T03:14:18Z","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 13c6bd5c12..088bf7f759 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -117,6 +117,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@@ -125,7 +126,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@@ -134,7 +134,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.0\n\n"},{"id":"408322","messageId":"20201025031343.346913-19-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 18/29] completion: zsh: simplify nl_append","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:32Z","receivedAt":"2020-10-25T03:14:19Z","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 f0babc784a..85365bd2f7 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -112,10 +112,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.0\n\n"},{"id":"408323","messageId":"20201025031343.346913-20-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 19/29] completion: zsh: simplify file_direct","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:33Z","receivedAt":"2020-10-25T03:14:20Z","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 85365bd2f7..aa484ad9ba 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -117,9 +117,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.0\n\n"},{"id":"408324","messageId":"20201025031343.346913-10-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 09/29] completion: bash: synchronize zsh wrapper","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:23Z","receivedAt":"2020-10-25T03:14:21Z","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.0\n\n"},{"id":"408325","messageId":"20201025031343.346913-21-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 20/29] completion: zsh: shuffle functions around","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:34Z","receivedAt":"2020-10-25T03:14:23Z","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 aa484ad9ba..179e8ff07d 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -97,11 +97,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@@ -110,21 +105,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.0\n\n"},{"id":"408326","messageId":"20201025031343.346913-25-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 24/29] completion: zsh: trivial simplification","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:38Z","receivedAt":"2020-10-25T03:14:26Z","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 d90eb6863b..1b2a43150d 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -78,7 +78,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.0\n\n"},{"id":"408327","messageId":"20201025031343.346913-23-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 22/29] completion: zsh: improve command tags","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:36Z","receivedAt":"2020-10-25T03:14:27Z","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 702ce8db25..2016e8c1b7 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -228,10 +228,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.0\n\n"},{"id":"408328","messageId":"20201025031343.346913-12-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 11/29] completion: zsh: fix completion for --no-.. options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:25Z","receivedAt":"2020-10-25T03:14:29Z","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 17041d0b23..c2a90beb8b 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -56,10 +56,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.0\n\n"},{"id":"408329","messageId":"20201025031343.346913-22-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 21/29] completion: zsh: refactor command completion","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:35Z","receivedAt":"2020-10-25T03:14:31Z","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 179e8ff07d..702ce8db25 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -127,20 +127,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.0\n\n"},{"id":"408330","messageId":"20201025031343.346913-26-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 25/29] completion: zsh: add simple version check","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:39Z","receivedAt":"2020-10-25T03:14:32Z","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 1b2a43150d..9fc9f2db21 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -127,6 +127,11 @@ __gitcomp_file_direct ()\n \t__gitcomp_file \"$1\" \"\"\n }\n \n+_git_zsh ()\n+{\n+\t__gitcomp \"v1.0\"\n+}\n+\n __git_complete_command ()\n {\n \temulate -L zsh\n-- \n2.29.0\n\n"},{"id":"408331","messageId":"20201025031343.346913-24-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 23/29] completion: zsh: add alias descriptions","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:37Z","receivedAt":"2020-10-25T03:14:35Z","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 2016e8c1b7..d90eb6863b 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -189,8 +189,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.0\n\n"},{"id":"408332","messageId":"20201025031343.346913-28-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 27/29] completion: bash: cleanup cygwin check","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:41Z","receivedAt":"2020-10-25T03:14:37Z","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 68e0acb232..ac1835cb30 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3500,6 +3500,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.0\n\n"},{"id":"408333","messageId":"20201025031343.346913-29-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 28/29] completion: bash: remove old compat wrappers","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:42Z","receivedAt":"2020-10-25T03:14:39Z","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 ac1835cb30..26538efb80 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3481,18 +3481,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.0\n\n"},{"id":"408334","messageId":"20201025031343.346913-27-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 26/29] completion: bash: trivial cleanup","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:40Z","receivedAt":"2020-10-25T03:14:41Z","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 6de0e7b482..68e0acb232 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.0\n\n"},{"id":"408335","messageId":"20201025031343.346913-30-felipe.contreras@gmail.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"[PATCH v2 29/29] Update copyright notices","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:13:43Z","receivedAt":"2020-10-25T03:14:44Z","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 9fc9f2db21..d25f8691ef 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.0\n\n"},{"id":"408526","messageId":"xmqqo8knbf4t.fsf@gitster.c.googlers.com","threadId":"54499","inReplyTo":"20201025031343.346913-1-felipe.contreras@gmail.com","subject":"Re: [PATCH v2 00/29] completion: zsh: latest patches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-27T20:14:26Z","receivedAt":"2020-10-27T20:14:31Z","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> I've been carrying around these patches for quite some time, many have already\n> been sent, others I refactored to make them more clear.\n>\n> But what is clear is that they are needed. I see a lot of people in different\n> forums (e.g. Stack Overflow, Oh-My-Zsh, etc.) getting bit by many of these\n> issues.\n\nIs this \"v2\" an update to the 14-patch series you have a late reply to?\n\nThere is a tiny zsh completion patch in flight, but hopefully it can\nbe rebased on this series and graduate together, provided if zsh\nusers on the list find the topic as a whole agreeable.\n\nThanks.\n"},{"id":"408572","messageId":"CAMP44s3HM5gqZhK8+266jgW1hO1SpoE4+1K-SmCErb7G9YhcBQ@mail.gmail.com","threadId":"54499","inReplyTo":"xmqqo8knbf4t.fsf@gitster.c.googlers.com","subject":"Re: [PATCH v2 00/29] completion: zsh: latest patches","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T01:48:27Z","receivedAt":"2020-10-28T22:41:46Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Tue, Oct 27, 2020 at 2:14 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>\n> > I've been carrying around these patches for quite some time, many have already\n> > been sent, others I refactored to make them more clear.\n> >\n> > But what is clear is that they are needed. I see a lot of people in different\n> > forums (e.g. Stack Overflow, Oh-My-Zsh, etc.) getting bit by many of these\n> > issues.\n>\n> Is this \"v2\" an update to the 14-patch series you have a late reply to?\n>\n> There is a tiny zsh completion patch in flight, but hopefully it can\n> be rebased on this series and graduate together, provided if zsh\n> users on the list find the topic as a whole agreeable.\n\nYes. That v1 should be dropped, this v2 supersedes that, but I'll send\nv3 in a moment.\n\n-- \nFelipe Contreras\n"}]}