{"thread":{"id":"42394","subject":"[PATCH 02/11] completion: bash: remove old wrappers","startedAt":"2016-05-20T04:58:34Z","lastAt":"2016-05-20T04:58:45Z","messageCount":12,"participants":["Felipe Contreras"],"isPatch":true,"patchVersion":1,"patchTotal":11},"messages":[{"id":"287060","messageId":"1463720325-8853-1-git-send-email-felipe.contreras@gmail.com","threadId":"42394","inReplyTo":null,"subject":"[PATCH 00/11] Completion fixes and improvements","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2016-05-20T04:58:34Z","receivedAt":"2016-05-20T04:58:34Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Hi,\n\nHere's a bunch of patches I've been using for a long time. I don't recall if\nI've sent some of these before.\n\nHere they are in case anybody is interested.\n\nCheers.\n\n\nFelipe Contreras (11):\n  completion: add missing fetch options\n  completion: bash: remove old wrappers\n  completion: bash: remove zsh wrapper\n  completion: zsh: don't hide ourselves\n  completion: remove zsh hack\n  completion: zsh: trivial cleanups\n  completion: bash: cleanup cygwin check\n  completion: zsh: improve main function selection\n  completion: zsh: fix for directories with spaces\n  completion: prompt: fix for Zsh\n  Revert \"Update documentation occurrences of filename .sh\"\n\n contrib/completion/git-completion.bash | 86 +++-------------------------------\n contrib/completion/git-completion.zsh  | 26 ++++------\n contrib/completion/git-prompt.sh       |  8 ++--\n 3 files changed, 20 insertions(+), 100 deletions(-)\n\n-- \n2.8.0+fc1\n"},{"id":"287069","messageId":"1463720325-8853-2-git-send-email-felipe.contreras@gmail.com","threadId":"42394","inReplyTo":"1463720325-8853-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 01/11] completion: add missing fetch options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2016-05-20T04:58:35Z","receivedAt":"2016-05-20T04:58: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.bash | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex e3918c8..ecdf742 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1225,6 +1225,8 @@ __git_fetch_recurse_submodules=\"yes on-demand no\"\n __git_fetch_options=\"\n \t--quiet --verbose --append --upload-pack --force --keep --depth=\n \t--tags --no-tags --all --prune --dry-run --recurse-submodules=\n+\t--no-recurse-submodules --unshallow --update-shallow --multiple\n+\t--submodule-prefix= --update-head-ok --progress\n \"\n \n _git_fetch ()\n-- \n2.8.0+fc1\n"},{"id":"287058","messageId":"1463720325-8853-3-git-send-email-felipe.contreras@gmail.com","threadId":"42394","inReplyTo":"1463720325-8853-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 02/11] completion: bash: remove old wrappers","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2016-05-20T04:58:36Z","receivedAt":"2016-05-20T04:58:36Z","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.bash | 12 ------------\n 1 file changed, 12 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex ecdf742..5e2e590 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2754,18 +2754,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.8.0+fc1\n"},{"id":"287059","messageId":"1463720325-8853-4-git-send-email-felipe.contreras@gmail.com","threadId":"42394","inReplyTo":"1463720325-8853-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 03/11] completion: bash: remove zsh wrapper","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2016-05-20T04:58:37Z","receivedAt":"2016-05-20T04:58:37Z","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 three years. It's time to move on.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 64 ----------------------------------\n 1 file changed, 64 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 5e2e590..9cbae6f 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2672,70 +2672,6 @@ __gitk_main ()\n \t__git_complete_revlist\n }\n \n-if [[ -n ${ZSH_VERSION-} ]]; 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_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_file ()\n-\t{\n-\t\temulate -L zsh\n-\n-\t\tlocal IFS=$'\\n'\n-\t\tcompset -P '*[=:]'\n-\t\tcompadd -Q -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-\treturn\n-fi\n-\n __git_func_wrap ()\n {\n \tlocal cur words cword prev\n-- \n2.8.0+fc1\n"},{"id":"287068","messageId":"1463720325-8853-5-git-send-email-felipe.contreras@gmail.com","threadId":"42394","inReplyTo":"1463720325-8853-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 04/11] completion: zsh: don't hide ourselves","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2016-05-20T04:58:38Z","receivedAt":"2016-05-20T04:58:38Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"There's no need to hide the fact that we are on zsh any more.\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 e255413..475705a 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -39,7 +39,7 @@ if [ -z \"$script\" ]; then\n \t\ttest -f $e && script=\"$e\" && break\n \tdone\n fi\n-ZSH_VERSION='' . \"$script\"\n+. \"$script\"\n \n __gitcomp ()\n {\n-- \n2.8.0+fc1\n"},{"id":"287062","messageId":"1463720325-8853-6-git-send-email-felipe.contreras@gmail.com","threadId":"42394","inReplyTo":"1463720325-8853-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 05/11] completion: remove zsh hack","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2016-05-20T04:58:39Z","receivedAt":"2016-05-20T04:58:39Z","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 9cbae6f..6c338ae 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2684,6 +2684,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 475705a..e10df7d 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -16,12 +16,6 @@\n #\n #  fpath=(~/.zsh $fpath)\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.8.0+fc1\n"},{"id":"287063","messageId":"1463720325-8853-7-git-send-email-felipe.contreras@gmail.com","threadId":"42394","inReplyTo":"1463720325-8853-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 06/11] completion: zsh: trivial cleanups","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2016-05-20T04:58:40Z","receivedAt":"2016-05-20T04:58:40Z","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\nAlso, we don't need to split files by ':' or '='; that's only for words.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 10 +++-------\n 1 file changed, 3 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex e10df7d..317b8eb 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -65,26 +65,22 @@ __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-\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 ()\n {\n \temulate -L zsh\n \n-\tlocal IFS=$'\\n'\n-\tcompset -P '*[=:]'\n-\tcompadd -Q -p \"${2-}\" -f -- ${=1} && _ret=0\n+\tcompadd -Q -p \"${2-}\" -f -- ${(f)1} && _ret=0\n }\n \n __git_zsh_bash_func ()\n-- \n2.8.0+fc1\n"},{"id":"287061","messageId":"1463720325-8853-8-git-send-email-felipe.contreras@gmail.com","threadId":"42394","inReplyTo":"1463720325-8853-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 07/11] completion: bash: cleanup cygwin check","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2016-05-20T04:58:41Z","receivedAt":"2016-05-20T04:58:41Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Avoid Yoda conditions, use test, and cleaner statement.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 6c338ae..398f3a7 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2698,6 +2698,5 @@ __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+test \"$(uname -o 2>/dev/null)\" = \"Cygwin\" &&\n __git_complete git.exe __git_main\n-fi\n-- \n2.8.0+fc1\n"},{"id":"287065","messageId":"1463720325-8853-9-git-send-email-felipe.contreras@gmail.com","threadId":"42394","inReplyTo":"1463720325-8853-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 08/11] completion: zsh: improve main function selection","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2016-05-20T04:58:42Z","receivedAt":"2016-05-20T04:58:42Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Sometimes we want to use the function directly (e.g. _git_checkout), for\nexample when zsh has the option 'complete_aliases', this way, we can do\nsomething like:\n\n  compdef _git gco=git_checkout\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.zsh | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 317b8eb..1f786cc 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -204,8 +204,10 @@ _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 \tfi\n \n \tlet _ret && _default && _ret=0\n-- \n2.8.0+fc1\n"},{"id":"287064","messageId":"1463720325-8853-10-git-send-email-felipe.contreras@gmail.com","threadId":"42394","inReplyTo":"1463720325-8853-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 09/11] completion: zsh: fix for directories with spaces","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2016-05-20T04:58:43Z","receivedAt":"2016-05-20T04:58:43Z","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 1f786cc..28eaaed 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -24,7 +24,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.8.0+fc1\n"},{"id":"287066","messageId":"1463720325-8853-11-git-send-email-felipe.contreras@gmail.com","threadId":"42394","inReplyTo":"1463720325-8853-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 10/11] completion: prompt: fix for Zsh","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2016-05-20T04:58:44Z","receivedAt":"2016-05-20T04:58:44Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"We can add colour in Zsh without the need of pcmode.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-prompt.sh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex 64219e6..0da14ee 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -502,9 +502,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.8.0+fc1\n"},{"id":"287067","messageId":"1463720325-8853-12-git-send-email-felipe.contreras@gmail.com","threadId":"42394","inReplyTo":"1463720325-8853-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 11/11] Revert \"Update documentation occurrences of filename .sh\"","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2016-05-20T04:58:45Z","receivedAt":"2016-05-20T04:58:45Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"The original code was correct: the example location ~/.git-completion.sh\nis correct, because it's not only used by Bash. And zstyle command in\nZsh should use that same location; the Bash script.\n\nThis reverts commit 0e5ed7cca3c51c821c2bb0465617e75d994f432f.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 4 ++--\n contrib/completion/git-completion.zsh  | 2 +-\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 398f3a7..3224ae1 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -17,9 +17,9 @@\n #\n # To use these routines:\n #\n-#    1) Copy this file to somewhere (e.g. ~/.git-completion.bash).\n+#    1) Copy this file to somewhere (e.g. ~/.git-completion.sh).\n #    2) Add the following line to your .bashrc/.zshrc:\n-#        source ~/.git-completion.bash\n+#        source ~/.git-completion.sh\n #    3) Consider changing your PS1 to also show the current branch,\n #       see git-prompt.sh for details.\n #\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 28eaaed..6075111 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.sh\n #\n # The recommended way to install this script is to copy to '~/.zsh/_git', and\n # then add the following to your ~/.zshrc file:\n-- \n2.8.0+fc1\n"}]}