{"thread":{"id":"51359","subject":"[PATCH 00/14] completion: a bunch of updates","startedAt":"2019-06-21T22:31:11Z","lastAt":"2020-11-05T22:09:14Z","messageCount":58,"participants":["Felipe Contreras","Duy Nguyen","Junio C Hamano","SZEDER Gábor","Stefan Haller","Aaron Schrab"],"isPatch":true,"patchVersion":1,"patchTotal":14},"messages":[{"id":"377779","messageId":"20190621223107.8022-1-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":null,"subject":"[PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:30:53Z","receivedAt":"2019-06-21T22:31:11Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Hi,\n\nHere's another try at completion fixes, cleanups, and more tests. Some\nof these have already been sent.\n\nFelipe Contreras (14):\n  completion: zsh: fix __gitcomp_direct()\n  completion: zsh: fix for directories with spaces\n  completion: remove zsh hack\n  completion: zsh: improve main function selection\n  completion: prompt: fix color for Zsh\n  completion: bash: cleanup cygwin check\n  completion: zsh: update installation instructions\n  completion: bash: remove old compat wrappers\n  completion: bash: remove zsh wrapper\n  completion: zsh: trivial cleanups\n  test: completion: tests for __gitcomp regression\n  test: completion: use global config\n  completion: add default options\n  completion: add default merge strategies\n\n contrib/completion/git-completion.bash | 202 +++++++++++++------------\n contrib/completion/git-completion.zsh  |  53 +++----\n contrib/completion/git-prompt.sh       |  10 +-\n t/t9902-completion.sh                  |  37 +++--\n 4 files changed, 161 insertions(+), 141 deletions(-)\n\n-- \n2.22.0\n\n"},{"id":"377780","messageId":"20190621223107.8022-2-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 01/14] completion: zsh: fix __gitcomp_direct()","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:30:54Z","receivedAt":"2019-06-21T22:31:13Z","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 9f71bcde96..a65d5956c1 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3009,7 +3009,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 886bf95d1f..0d66c27366 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -73,7 +73,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.22.0\n\n"},{"id":"377781","messageId":"20190621223107.8022-3-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 02/14] completion: zsh: fix for directories with spaces","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:30:55Z","receivedAt":"2019-06-21T22:31:14Z","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 0d66c27366..034cfa9e8f 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -30,7 +30,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.22.0\n\n"},{"id":"377782","messageId":"20190621223107.8022-4-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 03/14] completion: remove zsh hack","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:30:56Z","receivedAt":"2019-06-21T22:31:16Z","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 a65d5956c1..676b19a983 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3066,6 +3066,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 034cfa9e8f..aade33ec9f 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.22.0\n\n"},{"id":"377783","messageId":"20190621223107.8022-5-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 04/14] completion: zsh: improve main function selection","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:30:57Z","receivedAt":"2019-06-21T22:31:18Z","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 aade33ec9f..2801f2f7c8 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -226,8 +226,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.22.0\n\n"},{"id":"377784","messageId":"20190621223107.8022-6-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 05/14] completion: prompt: fix color for Zsh","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:30:58Z","receivedAt":"2019-06-21T22:31:19Z","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 | 10 ++++++----\n 1 file changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex 983e419d2b..b57a9c96cb 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -88,7 +88,7 @@\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 in Bash, 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@@ -506,9 +506,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.22.0\n\n"},{"id":"377785","messageId":"20190621223107.8022-9-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 08/14] completion: bash: remove old compat wrappers","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:31:01Z","receivedAt":"2019-06-21T22:31:22Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"It's been seven years, probably 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 dba822d0e7..1f9b833913 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3073,18 +3073,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.22.0\n\n"},{"id":"377786","messageId":"20190621223107.8022-8-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 07/14] completion: zsh: update installation instructions","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:31:00Z","receivedAt":"2019-06-21T22:31:23Z","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 extension doesn't really matter, but it confuses people.\n\nI've changed the text to make it clear that your zsh script goes to\n~/.zsh/_git, and the bash script to ~/.contrib/completion/git-completion.bash (or wherever\nyou want).\n\nAlso, update the default locations of the 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 | 23 +++++++++++++----------\n 1 file changed, 13 insertions(+), 10 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 2801f2f7c8..7f614d5854 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -4,17 +4,19 @@\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.zsh\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 #\n #  fpath=(~/.zsh $fpath)\n+#\n+# You need git's bash completion script installed. By default it will use\n+# bash-completion's script.\n+#\n+# If your bash completion script is somewhere else, you can configure it on\n+# your ~/.zshrc:\n+#\n+#  zstyle ':completion:*:*:git:*' script ~/.git-completion.bash\n+#\n \n zstyle -T ':completion:*:*:git:*' tag-order && \\\n \tzstyle ':completion:*:*:git:*' tag-order 'common-commands'\n@@ -25,9 +27,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.22.0\n\n"},{"id":"377787","messageId":"20190621223107.8022-7-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 06/14] completion: bash: cleanup cygwin check","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:30:59Z","receivedAt":"2019-06-21T22:31:23Z","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 676b19a983..dba822d0e7 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -3092,6 +3092,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.22.0\n\n"},{"id":"377788","messageId":"20190621223107.8022-10-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 09/14] completion: bash: remove zsh wrapper","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:31:02Z","receivedAt":"2019-06-21T22:31:25Z","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 seven years. It's time to move on.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 84 +-------------------------\n 1 file changed, 2 insertions(+), 82 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 1f9b833913..d3ee6c7dc2 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2969,88 +2969,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_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.22.0\n\n"},{"id":"377789","messageId":"20190621223107.8022-12-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 11/14] test: completion: tests for __gitcomp regression","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:31:04Z","receivedAt":"2019-06-21T22:31:26Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"There's a regression in the completion since the introduction of\n__gitcomp.\n\nGo to any directory that doesn't contain a git repository, like /tmp.\nThen type the following:\n\n  git checkout --<tab>\n\nYou will see nothing. That's because\n`git checkout --git-completion-helper` fails when you run it outside a\ngit repository.\n\nYou might change to a directory that has a git repository, but it's too\nlate, because the empty options have been cached.\n\nIt's unclear how many commands are affected, but this patch attempts to\nat least detect some already in the testing framework.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n t/t9902-completion.sh | 37 ++++++++++++++++++++++++++++---------\n 1 file changed, 28 insertions(+), 9 deletions(-)\n\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 43cf313a1c..7bef41eaf5 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -122,6 +122,15 @@ test_gitcomp_nl ()\n \ttest_cmp expected out\n }\n \n+offgit ()\n+{\n+\tGIT_CEILING_DIRECTORIES=\"$ROOT\" &&\n+\texport GIT_CEILING_DIRECTORIES &&\n+\ttest_when_finished \"ROOT='$ROOT'; cd '$TRASH_DIRECTORY'; unset GIT_CEILING_DIRECTORIES\" &&\n+\tROOT=\"$ROOT\"/non-repo &&\n+\tcd \"$ROOT\"\n+}\n+\n invalid_variable_name='${foo.bar}'\n \n actual=\"$TRASH_DIRECTORY/actual\"\n@@ -358,10 +367,8 @@ test_expect_success SYMLINKS '__git_find_repo_path - resulting path avoids symli\n '\n \n test_expect_success '__git_find_repo_path - not a git repository' '\n+\toffgit &&\n \t(\n-\t\tcd non-repo &&\n-\t\tGIT_CEILING_DIRECTORIES=\"$ROOT\" &&\n-\t\texport GIT_CEILING_DIRECTORIES &&\n \t\ttest_must_fail __git_find_repo_path &&\n \t\tprintf \"$__git_repo_path\" >\"$actual\"\n \t) &&\n@@ -1388,6 +1395,7 @@ test_expect_success '__git_pretty_aliases' '\n '\n \n test_expect_success 'basic' '\n+\toffgit &&\n \trun_completion \"git \" &&\n \t# built-in\n \tgrep -q \"^add \\$\" out &&\n@@ -1401,6 +1409,7 @@ test_expect_success 'basic' '\n '\n \n test_expect_success 'double dash \"git\" itself' '\n+\toffgit &&\n \ttest_completion \"git --\" <<-\\EOF\n \t--paginate Z\n \t--no-pager Z\n@@ -1419,7 +1428,8 @@ test_expect_success 'double dash \"git\" itself' '\n \tEOF\n '\n \n-test_expect_success 'double dash \"git checkout\"' '\n+test_expect_failure 'double dash \"git checkout\"' '\n+\toffgit &&\n \ttest_completion \"git checkout --\" <<-\\EOF\n \t--quiet Z\n \t--detach Z\n@@ -1442,6 +1452,7 @@ test_expect_success 'double dash \"git checkout\"' '\n '\n \n test_expect_success 'general options' '\n+\toffgit &&\n \ttest_completion \"git --ver\" \"--version \" &&\n \ttest_completion \"git --hel\" \"--help \" &&\n \ttest_completion \"git --exe\" <<-\\EOF &&\n@@ -1460,6 +1471,7 @@ test_expect_success 'general options' '\n '\n \n test_expect_success 'general options plus command' '\n+\toffgit &&\n \ttest_completion \"git --version check\" \"checkout \" &&\n \ttest_completion \"git --paginate check\" \"checkout \" &&\n \ttest_completion \"git --git-dir=foo check\" \"checkout \" &&\n@@ -1480,11 +1492,13 @@ test_expect_success 'general options plus command' '\n '\n \n test_expect_success 'git --help completion' '\n+\toffgit &&\n \ttest_completion \"git --help ad\" \"add \" &&\n \ttest_completion \"git --help core\" \"core-tutorial \"\n '\n \n-test_expect_success 'completion.commands removes multiple commands' '\n+test_expect_failure 'completion.commands removes multiple commands' '\n+\toffgit &&\n \ttest_config completion.commands \"-cherry -mergetool\" &&\n \tgit --list-cmds=list-mainporcelain,list-complete,config >out &&\n \t! grep -E \"^(cherry|mergetool)$\" out\n@@ -1547,9 +1561,10 @@ test_expect_success 'complete tree filename with metacharacters' '\n \tEOF\n '\n \n-test_expect_success PERL 'send-email' '\n-\ttest_completion \"git send-email --cov\" \"--cover-letter \" &&\n-\ttest_completion \"git send-email ma\" \"master \"\n+test_expect_failure PERL 'send-email' '\n+\ttest_completion \"git send-email ma\" \"master \" &&\n+\toffgit &&\n+\ttest_completion \"git send-email --cov\" \"--cover-letter \"\n '\n \n test_expect_success 'complete files' '\n@@ -1649,6 +1664,7 @@ test_expect_success 'completion used <cmd> completion for alias: !f() { : git <c\n '\n \n test_expect_success 'completion without explicit _git_xxx function' '\n+\toffgit &&\n \ttest_completion \"git version --\" <<-\\EOF\n \t--build-options Z\n \t--no-build-options Z\n@@ -1699,13 +1715,15 @@ do\n done\n \n test_expect_success 'sourcing the completion script clears cached commands' '\n+\toffgit &&\n \t__git_compute_all_commands &&\n \tverbose test -n \"$__git_all_commands\" &&\n \t. \"$GIT_BUILD_DIR/contrib/completion/git-completion.bash\" &&\n \tverbose test -z \"$__git_all_commands\"\n '\n \n-test_expect_success 'sourcing the completion script clears cached merge strategies' '\n+test_expect_failure 'sourcing the completion script clears cached merge strategies' '\n+\toffgit &&\n \tGIT_TEST_GETTEXT_POISON= &&\n \t__git_compute_merge_strategies &&\n \tverbose test -n \"$__git_merge_strategies\" &&\n@@ -1714,6 +1732,7 @@ test_expect_success 'sourcing the completion script clears cached merge strategi\n '\n \n test_expect_success 'sourcing the completion script clears cached --options' '\n+\toffgit &&\n \t__gitcomp_builtin checkout &&\n \tverbose test -n \"$__gitcomp_builtin_checkout\" &&\n \t__gitcomp_builtin notes_edit &&\n-- \n2.22.0\n\n"},{"id":"377790","messageId":"20190621223107.8022-11-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 10/14] completion: zsh: trivial cleanups","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:31:03Z","receivedAt":"2019-06-21T22:31:27Z","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 | 18 ++++++------------\n 1 file changed, 6 insertions(+), 12 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 7f614d5854..317f5bd80a 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -68,44 +68,38 @@ __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_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+\tcompset -P '*[=:]'\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-\tcompset -P '*[=:]'\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-\tcompset -P '*[=:]'\n-\tcompadd -p \"${2-}\" -f -- ${=1} && _ret=0\n+\tcompadd -f -p \"${2-}\" -- ${(f)1} && _ret=0\n }\n \n __git_zsh_bash_func ()\n-- \n2.22.0\n\n"},{"id":"377791","messageId":"20190621223107.8022-13-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 12/14] test: completion: use global config","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:31:05Z","receivedAt":"2019-06-21T22:31:28Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"When appropriate.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n t/t9902-completion.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 7bef41eaf5..3dbfef6960 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -1497,9 +1497,9 @@ test_expect_success 'git --help completion' '\n \ttest_completion \"git --help core\" \"core-tutorial \"\n '\n \n-test_expect_failure 'completion.commands removes multiple commands' '\n+test_expect_success 'completion.commands removes multiple commands' '\n \toffgit &&\n-\ttest_config completion.commands \"-cherry -mergetool\" &&\n+\ttest_config_global completion.commands \"-cherry -mergetool\" &&\n \tgit --list-cmds=list-mainporcelain,list-complete,config >out &&\n \t! grep -E \"^(cherry|mergetool)$\" out\n '\n@@ -1637,7 +1637,7 @@ test_expect_success 'complete files' '\n '\n \n test_expect_success \"completion uses <cmd> completion for alias: !sh -c 'git <cmd> ...'\" '\n-\ttest_config alias.co \"!sh -c '\"'\"'git checkout ...'\"'\"'\" &&\n+\ttest_config_global alias.co \"!sh -c '\"'\"'git checkout ...'\"'\"'\" &&\n \ttest_completion \"git co m\" <<-\\EOF\n \tmaster Z\n \tmybranch Z\n@@ -1646,7 +1646,7 @@ test_expect_success \"completion uses <cmd> completion for alias: !sh -c 'git <cm\n '\n \n test_expect_success 'completion uses <cmd> completion for alias: !f () { VAR=val git <cmd> ... }' '\n-\ttest_config alias.co \"!f () { VAR=val git checkout ... ; } f\" &&\n+\ttest_config_global alias.co \"!f () { VAR=val git checkout ... ; } f\" &&\n \ttest_completion \"git co m\" <<-\\EOF\n \tmaster Z\n \tmybranch Z\n@@ -1655,7 +1655,7 @@ test_expect_success 'completion uses <cmd> completion for alias: !f () { VAR=val\n '\n \n test_expect_success 'completion used <cmd> completion for alias: !f() { : git <cmd> ; ... }' '\n-\ttest_config alias.co \"!f() { : git checkout ; if ... } f\" &&\n+\ttest_config_global alias.co \"!f() { : git checkout ; if ... } f\" &&\n \ttest_completion \"git co m\" <<-\\EOF\n \tmaster Z\n \tmybranch Z\n-- \n2.22.0\n\n"},{"id":"377792","messageId":"20190621223107.8022-14-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 13/14] completion: add default options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:31:06Z","receivedAt":"2019-06-21T22:31:30Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Versions of Git older than v2.17 don't know about\n--git-completion-helper, so provide some defaults for them.\n\nAlso, some commands fail if there's no Git repository available.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 97 +++++++++++++++++++++++++-\n t/t9902-completion.sh                  |  4 +-\n 2 files changed, 98 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex d3ee6c7dc2..922ba5f925 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -377,6 +377,100 @@ else\n \tunset $(compgen -v __gitcomp_builtin_)\n fi\n \n+__gitcomp_builtin_add_default=\" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-removal --refresh --ignore-errors --ignore-missing --chmod= --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit --no-force --no-update --no-renormalize --no-intent-to-add --no-all --no-ignore-removal --no-refresh --no-ignore-errors --no-ignore-missing --no-chmod\"\n+__gitcomp_builtin_am_default=\" --interactive --3way --quiet --signoff --utf8 --keep --keep-non-patch --message-id --keep-cr --no-keep-cr --scissors --whitespace= --ignore-space-change --ignore-whitespace --directory= --exclude= --include= --patch-format= --reject --resolvemsg= --continue --resolved --skip --abort --quit --show-current-patch --committer-date-is-author-date --ignore-date --rerere-autoupdate --gpg-sign -- --no-interactive --no-3way --no-quiet --no-signoff --no-utf8 --no-keep --no-keep-non-patch --no-message-id --no-scissors --no-whitespace --no-ignore-space-change --no-ignore-whitespace --no-directory --no-exclude --no-include --no-patch-format --no-reject --no-resolvemsg --no-committer-date-is-author-date --no-ignore-date --no-rerere-autoupdate --no-gpg-sign\"\n+__gitcomp_builtin_apply_default=\" --exclude= --include= --no-add --stat --numstat --summary --check --index --intent-to-add --cached --apply --3way --build-fake-ancestor= --whitespace= --ignore-space-change --ignore-whitespace --reverse --unidiff-zero --reject --allow-overlap --verbose --inaccurate-eof --recount --directory= --add -- --no-stat --no-numstat --no-summary --no-check --no-index --no-intent-to-add --no-cached --no-apply --no-3way --no-build-fake-ancestor --no-whitespace --no-ignore-space-change --no-ignore-whitespace --no-reverse --no-unidiff-zero --no-reject --no-allow-overlap --no-verbose --no-inaccurate-eof --no-recount --no-directory\"\n+__gitcomp_builtin_archive_default=\" --output= --remote= --exec= --no-output -- --no-remote --no-exec\"\n+__gitcomp_builtin_bisect__helper_default=\" --next-all --write-terms --bisect-clean-state --check-expected-revs --bisect-reset --bisect-write --check-and-set-terms --bisect-next-check --bisect-terms --bisect-start --no-checkout --no-log --checkout --log\"\n+__gitcomp_builtin_blame_default=\" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --color-lines --color-by-age --indent-heuristic --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev\"\n+__gitcomp_builtin_branch_default=\" --verbose --quiet --track --set-upstream-to= --unset-upstream --color --remotes --contains --no-contains --abbrev --all --delete --move --copy --list --show-current --create-reflog --edit-description --merged --no-merged --column --sort= --points-at= --ignore-case --format= -- --no-verbose --no-quiet --no-track --no-set-upstream-to --no-unset-upstream --no-color --no-remotes --no-abbrev --no-all --no-delete --no-move --no-copy --no-list --no-show-current --no-create-reflog --no-edit-description --no-column --no-points-at --no-ignore-case --no-format\"\n+__gitcomp_builtin_cat_file_default=\" --textconv --filters --path= --allow-unknown-type --buffer --batch --batch-check --follow-symlinks --batch-all-objects --unordered --no-path -- --no-allow-unknown-type --no-buffer --no-follow-symlinks --no-batch-all-objects --no-unordered\"\n+__gitcomp_builtin_check_attr_default=\" --all --cached --stdin --no-all -- --no-cached --no-stdin\"\n+__gitcomp_builtin_check_ignore_default=\" --quiet --verbose --stdin --non-matching --no-index --index -- --no-quiet --no-verbose --no-stdin --no-non-matching\"\n+__gitcomp_builtin_check_mailmap_default=\" --stdin --no-stdin\"\n+__gitcomp_builtin_checkout_default=\" --quiet --detach --track --orphan= --ours --theirs --merge --conflict= --patch --ignore-skip-worktree-bits --no-guess --ignore-other-worktrees --recurse-submodules --progress --overlay --guess -- --no-quiet --no-detach --no-track --no-orphan --no-merge --no-conflict --no-patch --no-ignore-skip-worktree-bits --no-ignore-other-worktrees --no-recurse-submodules --no-progress --no-overlay\"\n+__gitcomp_builtin_checkout_index_default=\" --all --force --quiet --no-create --index --stdin --temp --prefix= --stage= --create -- --no-all --no-force --no-quiet --no-index --no-stdin --no-temp --no-prefix\"\n+__gitcomp_builtin_cherry_default=\" --abbrev --verbose --no-abbrev -- --no-verbose\"\n+__gitcomp_builtin_cherry_pick_default=\" --quit --continue --abort --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --ff --allow-empty --allow-empty-message --keep-redundant-commits --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign --no-ff --no-allow-empty --no-allow-empty-message --no-keep-redundant-commits\"\n+__gitcomp_builtin_clean_default=\" --quiet --dry-run --interactive --exclude= --no-quiet -- --no-dry-run --no-interactive\"\n+__gitcomp_builtin_clone_default=\" --verbose --quiet --progress --no-checkout --bare --mirror --local --no-hardlinks --shared --recursive --recurse-submodules --jobs= --template= --reference= --reference-if-able= --dissociate --origin= --branch= --upload-pack= --depth= --shallow-since= --shallow-exclude= --single-branch --no-tags --shallow-submodules --separate-git-dir= --config= --server-option= --ipv4 --ipv6 --filter= --checkout --hardlinks --tags -- --no-verbose --no-quiet --no-progress --no-bare --no-mirror --no-local --no-shared --no-recursive --no-recurse-submodules --no-jobs --no-template --no-reference --no-reference-if-able --no-dissociate --no-origin --no-branch --no-upload-pack --no-depth --no-shallow-since --no-shallow-exclude --no-single-branch --no-shallow-submodules --no-separate-git-dir --no-config --no-server-option --no-ipv4 --no-ipv6 --no-filter\"\n+__gitcomp_builtin_column_default=\" --command= --mode --raw-mode= --width= --indent= --nl= --padding= --no-command -- --no-mode --no-raw-mode --no-width --no-indent --no-nl --no-padding\"\n+__gitcomp_builtin_commit_default=\" --quiet --verbose --file= --author= --date= --message= --reedit-message= --reuse-message= --fixup= --squash= --reset-author --signoff --template= --edit --cleanup= --status --gpg-sign --all --include --interactive --patch --only --no-verify --dry-run --short --branch --ahead-behind --porcelain --long --null --amend --no-post-rewrite --untracked-files --verify --post-rewrite -- --no-quiet --no-verbose --no-file --no-author --no-date --no-message --no-reedit-message --no-reuse-message --no-fixup --no-squash --no-reset-author --no-signoff --no-template --no-edit --no-cleanup --no-status --no-gpg-sign --no-all --no-include --no-interactive --no-patch --no-only --no-dry-run --no-short --no-branch --no-ahead-behind --no-porcelain --no-long --no-null --no-amend --no-untracked-files\"\n+__gitcomp_builtin_commit_graph_default=\" --object-dir= --no-object-dir\"\n+__gitcomp_builtin_config_default=\" --global --system --local --worktree --file= --blob= --get --get-all --get-regexp --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section --list --edit --get-color --get-colorbool --type= --bool --int --bool-or-int --path --expiry-date --null --name-only --includes --show-origin --default= --no-global -- --no-system --no-local --no-worktree --no-file --no-blob --no-get --no-get-all --no-get-regexp --no-get-urlmatch --no-replace-all --no-add --no-unset --no-unset-all --no-rename-section --no-remove-section --no-list --no-edit --no-get-color --no-get-colorbool --no-type --no-null --no-name-only --no-includes --no-show-origin --no-default\"\n+__gitcomp_builtin_count_objects_default=\" --verbose --human-readable --no-verbose -- --no-human-readable\"\n+__gitcomp_builtin_describe_default=\" --contains --debug --all --tags --long --first-parent --abbrev --exact-match --candidates= --match= --exclude= --always --dirty --broken --no-contains -- --no-debug --no-all --no-tags --no-long --no-first-parent --no-abbrev --no-exact-match --no-candidates --no-match --no-exclude --no-always --no-dirty --no-broken\"\n+__gitcomp_builtin_difftool_default=\" --gui --dir-diff --no-prompt --symlinks --tool= --tool-help --trust-exit-code --extcmd= --no-index -- --no-gui --no-dir-diff --no-symlinks --no-tool --no-tool-help --no-trust-exit-code --no-extcmd\"\n+__gitcomp_builtin_fast_export_default=\" --progress= --signed-tags= --tag-of-filtered-object= --export-marks= --import-marks= --fake-missing-tagger --full-tree --use-done-feature --no-data --refspec= --anonymize --reference-excluded-parents --show-original-ids --data -- --no-progress --no-signed-tags --no-tag-of-filtered-object --no-export-marks --no-import-marks --no-fake-missing-tagger --no-full-tree --no-use-done-feature --no-refspec --no-anonymize --no-reference-excluded-parents --no-show-original-ids\"\n+__gitcomp_builtin_fetch_default=\" --verbose --quiet --all --append --upload-pack= --force --multiple --tags --jobs= --prune --prune-tags --recurse-submodules --dry-run --keep --update-head-ok --progress --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --filter= --no-verbose -- --no-quiet --no-all --no-append --no-upload-pack --no-force --no-multiple --no-tags --no-jobs --no-prune --no-prune-tags --no-recurse-submodules --no-dry-run --no-keep --no-update-head-ok --no-progress --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-filter\"\n+__gitcomp_builtin_fmt_merge_msg_default=\" --log --message= --file= --no-log -- --no-message --no-file\"\n+__gitcomp_builtin_for_each_ref_default=\" --shell --perl --python --tcl --count= --format= --color --sort= --points-at= --merged --no-merged --contains --no-contains --ignore-case -- --no-shell --no-perl --no-python --no-tcl --no-count --no-format --no-color --no-points-at --no-ignore-case\"\n+__gitcomp_builtin_format_patch_default=\" --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --rfc --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --to= --cc= --from --in-reply-to= --attach --inline --thread --signature= --base= --signature-file= --quiet --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-numbered --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-to --no-cc --no-from --no-in-reply-to --no-attach --no-thread --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor\"\n+__gitcomp_builtin_fsck_default=\" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects\"\n+__gitcomp_builtin_fsck_objects_default=\" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects\"\n+__gitcomp_builtin_gc_default=\" --quiet --prune --aggressive --keep-largest-pack --no-quiet -- --no-prune --no-aggressive --no-keep-largest-pack\"\n+__gitcomp_builtin_grep_default=\" --cached --no-index --untracked --exclude-standard --recurse-submodules --invert-match --ignore-case --word-regexp --text --textconv --recursive --max-depth= --extended-regexp --basic-regexp --fixed-strings --perl-regexp --line-number --column --full-name --files-with-matches --name-only --files-without-match --only-matching --count --color --break --heading --context= --before-context= --after-context= --threads= --show-function --function-context --and --or --not --quiet --all-match --index -- --no-cached --no-untracked --no-exclude-standard --no-recurse-submodules --no-invert-match --no-ignore-case --no-word-regexp --no-text --no-textconv --no-recursive --no-extended-regexp --no-basic-regexp --no-fixed-strings --no-perl-regexp --no-line-number --no-column --no-full-name --no-files-with-matches --no-name-only --no-files-without-match --no-only-matching --no-count --no-color --no-break --no-heading --no-context --no-before-context --no-after-context --no-threads --no-show-function --no-function-context --no-or --no-quiet --no-all-match\"\n+__gitcomp_builtin_hash_object_default=\" --stdin --stdin-paths --no-filters --literally --path= --filters -- --no-stdin --no-stdin-paths --no-literally --no-path\"\n+__gitcomp_builtin_help_default=\" --all --guides --config --man --web --info --verbose --no-all -- --no-guides --no-config --no-man --no-web --no-info --no-verbose\"\n+__gitcomp_builtin_init_default=\" --template= --bare --shared --quiet --separate-git-dir= --no-template -- --no-bare --no-quiet --no-separate-git-dir\"\n+__gitcomp_builtin_init_db_default=\" --template= --bare --shared --quiet --separate-git-dir= --no-template -- --no-bare --no-quiet --no-separate-git-dir\"\n+__gitcomp_builtin_interpret_trailers_default=\" --in-place --trim-empty --where= --if-exists= --if-missing= --only-trailers --only-input --unfold --parse --no-divider --trailer= --divider -- --no-in-place --no-trim-empty --no-where --no-if-exists --no-if-missing --no-only-trailers --no-only-input --no-unfold --no-trailer\"\n+__gitcomp_builtin_log_default=\" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate\"\n+__gitcomp_builtin_ls_files_default=\" --cached --deleted --modified --others --ignored --stage --killed --directory --eol --empty-directory --unmerged --resolve-undo --exclude= --exclude-from= --exclude-per-directory= --exclude-standard --full-name --recurse-submodules --error-unmatch --with-tree= --abbrev --debug --no-cached -- --no-deleted --no-modified --no-others --no-ignored --no-stage --no-killed --no-directory --no-eol --no-empty-directory --no-unmerged --no-resolve-undo --no-exclude-per-directory --no-recurse-submodules --no-error-unmatch --no-with-tree --no-abbrev --no-debug\"\n+__gitcomp_builtin_ls_remote_default=\" --quiet --upload-pack= --tags --heads --refs --get-url --sort= --symref --server-option= --no-quiet -- --no-upload-pack --no-tags --no-heads --no-refs --no-get-url --no-symref --no-server-option\"\n+__gitcomp_builtin_ls_tree_default=\" --long --name-only --name-status --full-name --full-tree --abbrev --no-long -- --no-name-only --no-name-status --no-full-name --no-full-tree --no-abbrev\"\n+__gitcomp_builtin_merge_default=\" --stat --summary --log --squash --commit --edit --cleanup= --ff --ff-only --rerere-autoupdate --verify-signatures --strategy= --strategy-option= --message= --file --verbose --quiet --abort --continue --allow-unrelated-histories --progress --gpg-sign --overwrite-ignore --signoff --verify --no-stat -- --no-summary --no-log --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-rerere-autoupdate --no-verify-signatures --no-strategy --no-strategy-option --no-message --no-verbose --no-quiet --no-abort --no-continue --no-allow-unrelated-histories --no-progress --no-gpg-sign --no-overwrite-ignore --no-signoff --no-verify\"\n+__gitcomp_builtin_merge_base_default=\" --all --octopus --independent --is-ancestor --fork-point --no-all\"\n+__gitcomp_builtin_merge_file_default=\" --stdout --diff3 --ours --theirs --union --marker-size= --quiet --no-stdout -- --no-diff3 --no-ours --no-theirs --no-union --no-marker-size --no-quiet\"\n+__gitcomp_builtin_mktree_default=\" --missing --batch --no-missing -- --no-batch\"\n+__gitcomp_builtin_multi_pack_index_default=\" --object-dir= --no-object-dir\"\n+__gitcomp_builtin_mv_default=\" --verbose --dry-run --no-verbose -- --no-dry-run\"\n+__gitcomp_builtin_name_rev_default=\" --name-only --tags --refs= --exclude= --all --stdin --undefined --always --no-name-only -- --no-tags --no-refs --no-exclude --no-all --no-stdin --no-undefined --no-always\"\n+__gitcomp_builtin_notes_default=\" --ref= --no-ref\"\n+__gitcomp_builtin_pack_objects_default=\" --quiet --progress --all-progress --all-progress-implied --index-version= --max-pack-size= --local --incremental --window= --window-memory= --depth= --reuse-delta --reuse-object --delta-base-offset --threads= --non-empty --revs --unpacked --all --reflog --indexed-objects --stdout --include-tag --keep-unreachable --pack-loose-unreachable --unpack-unreachable --sparse --thin --shallow --honor-pack-keep --keep-pack= --compression= --keep-true-parents --use-bitmap-index --write-bitmap-index --filter= --missing= --exclude-promisor-objects --delta-islands --no-quiet -- --no-progress --no-all-progress --no-all-progress-implied --no-local --no-incremental --no-window --no-depth --no-reuse-delta --no-reuse-object --no-delta-base-offset --no-threads --no-non-empty --no-revs --no-stdout --no-include-tag --no-keep-unreachable --no-pack-loose-unreachable --no-unpack-unreachable --no-sparse --no-thin --no-shallow --no-honor-pack-keep --no-keep-pack --no-compression --no-keep-true-parents --no-use-bitmap-index --no-write-bitmap-index --no-filter --no-exclude-promisor-objects --no-delta-islands\"\n+__gitcomp_builtin_pack_refs_default=\" --all --prune --no-all -- --no-prune\"\n+__gitcomp_builtin_pickaxe_default=\" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --color-lines --color-by-age --indent-heuristic --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev\"\n+__gitcomp_builtin_prune_default=\" --dry-run --verbose --progress --expire= --exclude-promisor-objects --no-dry-run -- --no-verbose --no-progress --no-expire --no-exclude-promisor-objects\"\n+__gitcomp_builtin_prune_packed_default=\" --dry-run --quiet --no-dry-run -- --no-quiet\"\n+__gitcomp_builtin_pull_default=\" --verbose --quiet --progress --recurse-submodules --rebase --stat --log --signoff --squash --commit --edit --cleanup= --ff --ff-only --verify-signatures --autostash --strategy= --strategy-option= --gpg-sign --allow-unrelated-histories --all --append --upload-pack= --force --tags --prune --jobs --dry-run --keep --depth= --unshallow --update-shallow --refmap= --ipv4 --ipv6 --no-verbose -- --no-quiet --no-progress --no-recurse-submodules --no-rebase --no-stat --no-log --no-signoff --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-verify-signatures --no-autostash --no-strategy --no-strategy-option --no-gpg-sign --no-allow-unrelated-histories --no-all --no-append --no-upload-pack --no-force --no-tags --no-prune --no-jobs --no-dry-run --no-keep --no-depth --no-update-shallow --no-ipv4 --no-ipv6\"\n+__gitcomp_builtin_push_default=\" --verbose --quiet --repo= --all --mirror --delete --tags --dry-run --porcelain --force --force-with-lease --recurse-submodules --receive-pack= --exec= --set-upstream --progress --prune --no-verify --follow-tags --signed --atomic --push-option= --ipv4 --ipv6 --verify -- --no-verbose --no-quiet --no-repo --no-all --no-mirror --no-delete --no-tags --no-dry-run --no-porcelain --no-force --no-force-with-lease --no-recurse-submodules --no-receive-pack --no-exec --no-set-upstream --no-progress --no-prune --no-follow-tags --no-signed --no-atomic --no-push-option --no-ipv4 --no-ipv6\"\n+__gitcomp_builtin_range_diff_default=\" --creation-factor= --no-dual-color --patch --no-patch --unified --function-context --raw --patch-with-raw --patch-with-stat --numstat --shortstat --dirstat --cumulative --dirstat-by-file --check --summary --name-only --name-status --stat --stat-width= --stat-name-width= --stat-graph-width= --stat-count= --compact-summary --binary --full-index --color --ws-error-highlight= --abbrev --src-prefix= --dst-prefix= --line-prefix= --no-prefix --inter-hunk-context= --output-indicator-new= --output-indicator-old= --output-indicator-context= --break-rewrites --find-renames --irreversible-delete --find-copies --find-copies-harder --no-renames --rename-empty --follow --minimal --ignore-all-space --ignore-space-change --ignore-space-at-eol --ignore-cr-at-eol --ignore-blank-lines --indent-heuristic --patience --histogram --diff-algorithm= --anchored= --word-diff --word-diff-regex= --color-words --color-moved --color-moved-ws= --relative --text --exit-code --quiet --ext-diff --textconv --ignore-submodules --submodule --ita-invisible-in-index --ita-visible-in-index --pickaxe-all --pickaxe-regex --find-object= --diff-filter= --output= --dual-color -- --no-creation-factor --no-function-context --no-compact-summary --no-full-index --no-color --no-abbrev --no-find-copies-harder --no-rename-empty --no-follow --no-minimal --no-indent-heuristic --no-color-moved --no-color-moved-ws --no-text --no-exit-code --no-quiet --no-ext-diff --no-textconv\"\n+__gitcomp_builtin_read_tree_default=\" --index-output= --empty --verbose --trivial --aggressive --reset --prefix= --exclude-per-directory= --dry-run --no-sparse-checkout --debug-unpack --recurse-submodules --quiet --sparse-checkout -- --no-empty --no-verbose --no-trivial --no-aggressive --no-reset --no-dry-run --no-debug-unpack --no-recurse-submodules --no-quiet\"\n+__gitcomp_builtin_rebase_default=\" --onto= --no-verify --quiet --verbose --no-stat --signoff --ignore-whitespace --committer-date-is-author-date --ignore-date --whitespace= --force-rebase --no-ff --continue --skip --abort --quit --edit-todo --show-current-patch --merge --interactive --preserve-merges --rerere-autoupdate --keep-empty --autosquash --gpg-sign --autostash --exec= --allow-empty-message --rebase-merges --fork-point --strategy= --strategy-option= --root --reschedule-failed-exec --verify --stat --ff -- --no-onto --no-quiet --no-verbose --no-signoff --no-ignore-whitespace --no-committer-date-is-author-date --no-ignore-date --no-whitespace --no-force-rebase --no-preserve-merges --no-rerere-autoupdate --no-keep-empty --no-autosquash --no-gpg-sign --no-autostash --no-exec --no-allow-empty-message --no-rebase-merges --no-fork-point --no-strategy --no-strategy-option --no-root --no-reschedule-failed-exec\"\n+__gitcomp_builtin_rebase__interactive_default=\" --ff --keep-empty --allow-empty-message --rebase-merges --rebase-cousins --autosquash --signoff --verbose --continue --skip --edit-todo --show-current-patch --shorten-ids --expand-ids --check-todo-list --rearrange-squash --add-exec-commands --onto= --restrict-revision= --squash-onto= --upstream= --head-name= --gpg-sign --strategy= --strategy-opts= --switch-to= --onto-name= --cmd= --rerere-autoupdate --reschedule-failed-exec --no-ff -- --no-keep-empty --no-allow-empty-message --no-rebase-merges --no-rebase-cousins --no-autosquash --no-signoff --no-verbose --no-head-name --no-gpg-sign --no-strategy --no-strategy-opts --no-switch-to --no-onto-name --no-cmd --no-rerere-autoupdate --no-reschedule-failed-exec\"\n+__gitcomp_builtin_receive_pack_default=\" --quiet --no-quiet\"\n+__gitcomp_builtin_reflog_default=\" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate\"\n+__gitcomp_builtin_remote_default=\" --verbose --no-verbose\"\n+__gitcomp_builtin_repack_default=\" --quiet --local --write-bitmap-index --delta-islands --unpack-unreachable= --keep-unreachable --window= --window-memory= --depth= --threads= --max-pack-size= --pack-kept-objects --keep-pack= --no-quiet -- --no-local --no-write-bitmap-index --no-delta-islands --no-unpack-unreachable --no-keep-unreachable --no-window --no-window-memory --no-depth --no-threads --no-max-pack-size --no-pack-kept-objects --no-keep-pack\"\n+__gitcomp_builtin_replace_default=\" --list --delete --edit --graft --convert-graft-file --raw --format= --no-raw -- --no-format\"\n+__gitcomp_builtin_rerere_default=\" --rerere-autoupdate --no-rerere-autoupdate\"\n+__gitcomp_builtin_reset_default=\" --quiet --mixed --soft --hard --merge --keep --recurse-submodules --patch --intent-to-add --no-quiet -- --no-mixed --no-soft --no-hard --no-merge --no-keep --no-recurse-submodules --no-patch --no-intent-to-add\"\n+__gitcomp_builtin_revert_default=\" --quit --continue --abort --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign\"\n+__gitcomp_builtin_rm_default=\" --dry-run --quiet --cached --ignore-unmatch --no-dry-run -- --no-quiet --no-cached --no-ignore-unmatch\"\n+__gitcomp_builtin_send_pack_default=\" --verbose --quiet --receive-pack= --exec= --remote= --all --dry-run --mirror --force --signed --push-option= --progress --thin --atomic --stateless-rpc --stdin --helper-status --force-with-lease --no-verbose -- --no-quiet --no-receive-pack --no-exec --no-remote --no-all --no-dry-run --no-mirror --no-force --no-signed --no-push-option --no-progress --no-thin --no-atomic --no-stateless-rpc --no-stdin --no-helper-status --no-force-with-lease\"\n+__gitcomp_builtin_shortlog_default=\" --committer --numbered --summary --email --no-committer -- --no-numbered --no-summary --no-email\"\n+__gitcomp_builtin_show_default=\" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate\"\n+__gitcomp_builtin_show_branch_default=\" --all --remotes --color --more --list --no-name --current --sha1-name --merge-base --independent --topo-order --topics --sparse --date-order --reflog --name -- --no-all --no-remotes --no-color --no-more --no-list --no-current --no-sha1-name --no-merge-base --no-independent --no-topo-order --no-topics --no-sparse --no-date-order\"\n+__gitcomp_builtin_show_index_default=\"\"\n+__gitcomp_builtin_show_ref_default=\" --tags --heads --verify --head --dereference --hash --abbrev --quiet --exclude-existing --no-tags -- --no-heads --no-verify --no-head --no-dereference --no-hash --no-abbrev --no-quiet\"\n+__gitcomp_builtin_stage_default=\" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-removal --refresh --ignore-errors --ignore-missing --chmod= --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit --no-force --no-update --no-renormalize --no-intent-to-add --no-all --no-ignore-removal --no-refresh --no-ignore-errors --no-ignore-missing --no-chmod\"\n+__gitcomp_builtin_stash_default=\"\"\n+__gitcomp_builtin_status_default=\" --verbose --short --branch --show-stash --ahead-behind --porcelain --long --null --untracked-files --ignored --ignore-submodules --column --no-renames --find-renames --renames -- --no-verbose --no-short --no-branch --no-show-stash --no-ahead-behind --no-porcelain --no-long --no-null --no-untracked-files --no-ignored --no-ignore-submodules --no-column\"\n+__gitcomp_builtin_stripspace_default=\" --strip-comments --comment-lines\"\n+__gitcomp_builtin_symbolic_ref_default=\" --quiet --delete --short --no-quiet -- --no-delete --no-short\"\n+__gitcomp_builtin_tag_default=\" --list --delete --verify --annotate --message= --file= --edit --sign --cleanup= --local-user= --force --create-reflog --column --contains --no-contains --merged --no-merged --sort= --points-at --format= --color --ignore-case -- --no-annotate --no-file --no-edit --no-sign --no-cleanup --no-local-user --no-force --no-create-reflog --no-column --no-points-at --no-format --no-color --no-ignore-case\"\n+__gitcomp_builtin_update_index_default=\" --ignore-submodules --add --replace --remove --unmerged --refresh --really-refresh --cacheinfo --chmod= --assume-unchanged --no-assume-unchanged --skip-worktree --no-skip-worktree --info-only --force-remove --stdin --index-info --unresolve --again --ignore-missing --verbose --clear-resolve-undo --index-version= --split-index --untracked-cache --test-untracked-cache --force-untracked-cache --force-write-index --fsmonitor --fsmonitor-valid --no-fsmonitor-valid -- --no-ignore-submodules --no-add --no-replace --no-remove --no-unmerged --no-info-only --no-force-remove --no-ignore-missing --no-verbose --no-index-version --no-split-index --no-untracked-cache --no-test-untracked-cache --no-force-untracked-cache --no-force-write-index --no-fsmonitor\"\n+__gitcomp_builtin_update_ref_default=\" --no-deref --stdin --create-reflog --deref -- --no-stdin --no-create-reflog\"\n+__gitcomp_builtin_update_server_info_default=\" --force --no-force\"\n+__gitcomp_builtin_upload_pack_default=\" --stateless-rpc --advertise-refs --strict --timeout= --no-stateless-rpc -- --no-advertise-refs --no-strict --no-timeout\"\n+__gitcomp_builtin_verify_commit_default=\" --verbose --raw --no-verbose -- --no-raw\"\n+__gitcomp_builtin_verify_pack_default=\" --verbose --stat-only --no-verbose -- --no-stat-only\"\n+__gitcomp_builtin_verify_tag_default=\" --verbose --raw --format= --no-verbose -- --no-raw --no-format\"\n+__gitcomp_builtin_version_default=\" --build-options --no-build-options\"\n+__gitcomp_builtin_whatchanged_default=\" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate\"\n+__gitcomp_builtin_write_tree_default=\" --missing-ok --prefix= --no-missing-ok -- --no-prefix\"\n+__gitcomp_builtin_send_email_default=\" --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --rfc --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --to= --cc= --from --in-reply-to= --attach --inline --thread --signature= --base= --signature-file= --quiet --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-numbered --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-to --no-cc --no-from --no-in-reply-to --no-attach --no-thread --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor\"\n+\n # This function is equivalent to\n #\n #    __gitcomp \"$(git xxx --git-completion-helper) ...\"\n@@ -400,7 +494,8 @@ __gitcomp_builtin ()\n \tif [ -z \"$options\" ]; then\n \t\t# leading and trailing spaces are significant to make\n \t\t# option removal work correctly.\n-\t\toptions=\" $incl $(__git ${cmd/_/ } --git-completion-helper) \"\n+\t\toptions=\" $incl $(__git ${cmd/_/ } --git-completion-helper) \" ||\n+\t\t\teval \"options=\\\" $incl \\$${var}_default \\\"\"\n \t\tfor i in $excl; do\n \t\t\toptions=\"${options/ $i / }\"\n \t\tdone\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 3dbfef6960..14598bfbec 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -1428,7 +1428,7 @@ test_expect_success 'double dash \"git\" itself' '\n \tEOF\n '\n \n-test_expect_failure 'double dash \"git checkout\"' '\n+test_expect_success 'double dash \"git checkout\"' '\n \toffgit &&\n \ttest_completion \"git checkout --\" <<-\\EOF\n \t--quiet Z\n@@ -1561,7 +1561,7 @@ test_expect_success 'complete tree filename with metacharacters' '\n \tEOF\n '\n \n-test_expect_failure PERL 'send-email' '\n+test_expect_success PERL 'send-email' '\n \ttest_completion \"git send-email ma\" \"master \" &&\n \toffgit &&\n \ttest_completion \"git send-email --cov\" \"--cover-letter \"\n-- \n2.22.0\n\n"},{"id":"377793","messageId":"20190621223107.8022-15-felipe.contreras@gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"[PATCH 14/14] completion: add default merge strategies","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-21T22:31:07Z","receivedAt":"2019-06-21T22:31:31Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"In case the command fails.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 4 +++-\n t/t9902-completion.sh                  | 2 +-\n 2 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 922ba5f925..91b87eb558 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -936,6 +936,7 @@ __git_list_merge_strategies ()\n \t}'\n }\n \n+__git_merge_strategies_default='octopus ours recursive resolve subtree'\n __git_merge_strategies=\n # 'git merge -s help' (and thus detection of the merge strategy\n # list) fails, unfortunately, if run outside of any git working\n@@ -945,7 +946,8 @@ __git_merge_strategies=\n __git_compute_merge_strategies ()\n {\n \ttest -n \"$__git_merge_strategies\" ||\n-\t__git_merge_strategies=$(__git_list_merge_strategies)\n+\t{ __git_merge_strategies=$(__git_list_merge_strategies);\n+\t\t__git_merge_strategies=\"${__git_merge_strategies:-__git_merge_strategies_default}\"; }\n }\n \n __git_merge_strategy_options=\"ours theirs subtree subtree= patience\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 14598bfbec..f4453ce70d 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -1722,7 +1722,7 @@ test_expect_success 'sourcing the completion script clears cached commands' '\n \tverbose test -z \"$__git_all_commands\"\n '\n \n-test_expect_failure 'sourcing the completion script clears cached merge strategies' '\n+test_expect_success 'sourcing the completion script clears cached merge strategies' '\n \toffgit &&\n \tGIT_TEST_GETTEXT_POISON= &&\n \t__git_compute_merge_strategies &&\n-- \n2.22.0\n\n"},{"id":"377800","messageId":"CACsJy8AATA-7Z+HsA80NQ2j4Z9JeuSYXiBZLi=7FopzfLY1R+w@mail.gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-14-felipe.contreras@gmail.com","subject":"Re: [PATCH 13/14] completion: add default options","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2019-06-22T03:01:36Z","receivedAt":"2019-06-22T03:02:05Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Jun 22, 2019 at 5:31 AM Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n>\n> Versions of Git older than v2.17 don't know about\n> --git-completion-helper, so provide some defaults for them.\n>\n> Also, some commands fail if there's no Git repository available.\n>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  contrib/completion/git-completion.bash | 97 +++++++++++++++++++++++++-\n>  t/t9902-completion.sh                  |  4 +-\n>  2 files changed, 98 insertions(+), 3 deletions(-)\n>\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index d3ee6c7dc2..922ba5f925 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -377,6 +377,100 @@ else\n>         unset $(compgen -v __gitcomp_builtin_)\n>  fi\n>\n> +__gitcomp_builtin_add_default=\" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-\nremoval --refresh --ignore-errors --ignore-missing --chmod=\n--no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit\n--no-force --no-update --no-renormalize --no-intent-to-add --no-all\n--no-ignore-removal --no-refresh --no-ignore-errors\n--no-ignore-missing --no-chmod\"\n\nAnd who's going to keep these uptodate? If you do this, might as well\ndelete --git-completion-helper\n\nA more acceptable option might be regenerate git-completion.bash and\nrun --git-completion-helper to generate these, or make\ngit-completion.bash source a generated file. But that might need some\nmore build infrastructure, and people who just one to copy the file\nmight not like it.\n-- \nDuy\n"},{"id":"377802","messageId":"CAMP44s0+OoqhXHX1BD7Gw-0GqgyKYPw4GzhNr9n2pOfxjWcMYg@mail.gmail.com","threadId":"51359","inReplyTo":"CACsJy8AATA-7Z+HsA80NQ2j4Z9JeuSYXiBZLi=7FopzfLY1R+w@mail.gmail.com","subject":"Re: [PATCH 13/14] completion: add default options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-22T04:36:28Z","receivedAt":"2019-06-22T04:38:10Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Fri, Jun 21, 2019 at 10:02 PM Duy Nguyen <pclouds@gmail.com> wrote:\n>\n> On Sat, Jun 22, 2019 at 5:31 AM Felipe Contreras\n> <felipe.contreras@gmail.com> wrote:\n> >\n> > Versions of Git older than v2.17 don't know about\n> > --git-completion-helper, so provide some defaults for them.\n> >\n> > Also, some commands fail if there's no Git repository available.\n> >\n> > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> > ---\n> >  contrib/completion/git-completion.bash | 97 +++++++++++++++++++++++++-\n> >  t/t9902-completion.sh                  |  4 +-\n> >  2 files changed, 98 insertions(+), 3 deletions(-)\n> >\n> > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> > index d3ee6c7dc2..922ba5f925 100644\n> > --- a/contrib/completion/git-completion.bash\n> > +++ b/contrib/completion/git-completion.bash\n> > @@ -377,6 +377,100 @@ else\n> >         unset $(compgen -v __gitcomp_builtin_)\n> >  fi\n> >\n> > +__gitcomp_builtin_add_default=\" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-\n> removal --refresh --ignore-errors --ignore-missing --chmod=\n> --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit\n> --no-force --no-update --no-renormalize --no-intent-to-add --no-all\n> --no-ignore-removal --no-refresh --no-ignore-errors\n> --no-ignore-missing --no-chmod\"\n>\n> And who's going to keep these uptodate?\n\nThe same people that kept them up-to-date before git-completion-helper.\n\n> If you do this, might as well delete --git-completion-helper\n\nThey serve two different purposes. Say you install the completion of\nGit v2.22, but a while later you have Git v2.25; you will get the\nupdated commands thanks to git-completion-helper, and all the\n__gitcomp_builtin_*_default will be ignored.\n\nGranted; that's not the typical situation, as many people get the Git\ncompletion through their distribution in tandem with their Git\nversion. But remember that these completion scripts are part of\ncontrib; they are not part of official Git (`make install` doesn't\ninstall them).\n\nWhen a) most people have a version of git that has\ngit-completion-helper, and b) most of the issues running commands\noutside of a Git repo are resolved, they could be removed. But right\nnow they do serve a purpose.\n\n> A more acceptable option might be regenerate git-completion.bash and\n> run --git-completion-helper to generate these, or make\n> git-completion.bash source a generated file. But that might need some\n> more build infrastructure, and people who just one to copy the file\n> might not like it.\n\nIndeed, I wrote a script to generate these, but I manually copied\nthem. I could write a script that automatically generates this file if\nit's agreed that this is indeed the way we want to go.\n\nBut even if these were not up-to-date--as historically has been the\ncase for most options--and a) you are running a version of Git that\ndoesn't have git-completion-helper, or b) you run a command that\nrequires a Git repo; it's better to get outdated options than to get\n*nothing*, which is what we get now.\n\nCheers.\n\n-- \nFelipe Contreras\n"},{"id":"377815","messageId":"CAMP44s1ZZu97tbPS6xGi6=i3r-+bA2E=Ug5BeXmzKH9=dWqE8w@mail.gmail.com","threadId":"51359","inReplyTo":"20190621223107.8022-2-felipe.contreras@gmail.com","subject":"Re: [PATCH 01/14] completion: zsh: fix __gitcomp_direct()","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-22T15:03:22Z","receivedAt":"2019-06-22T15:03:36Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Fri, Jun 21, 2019 at 5:31 PM Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n>\n> Many callers append a space suffix, but zsh automatically appends a\n> space, making the completion add two spaces, for example:\n\n> --- a/contrib/completion/git-completion.zsh\n> +++ b/contrib/completion/git-completion.zsh\n> @@ -73,7 +73,7 @@ __gitcomp_direct ()\n>\n>         local IFS=$'\\n'\n>         compset -P '*[=:]'\n> -       compadd -Q -- ${=1} && _ret=0\n> +       compadd -Q -- ${${=1}% } && _ret=0\n\nThis is better actually:\n\ncompadd -Q -S '' -- ${=1} && _ret=0\n\n-- \nFelipe Contreras\n"},{"id":"377902","messageId":"xmqqa7e6j3u1.fsf@gitster-ct.c.googlers.com","threadId":"51359","inReplyTo":"CACsJy8AATA-7Z+HsA80NQ2j4Z9JeuSYXiBZLi=7FopzfLY1R+w@mail.gmail.com","subject":"Re: [PATCH 13/14] completion: add default options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-06-24T17:22:30Z","receivedAt":"2019-06-24T17:22:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n> On Sat, Jun 22, 2019 at 5:31 AM Felipe Contreras\n> <felipe.contreras@gmail.com> wrote:\n>>\n>> Versions of Git older than v2.17 don't know about\n>> --git-completion-helper, so provide some defaults for them.\n> ...\n>> +__gitcomp_builtin_add_default=\" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-\n> removal --refresh --ignore-errors --ignore-missing --chmod=\n> --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit\n> --no-force --no-update --no-renormalize --no-intent-to-add --no-all\n> --no-ignore-removal --no-refresh --no-ignore-errors\n> --no-ignore-missing --no-chmod\"\n>\n> And who's going to keep these uptodate? If you do this, might as well\n> delete --git-completion-helper\n>\n> A more acceptable option might be regenerate git-completion.bash and\n> run --git-completion-helper to generate these, or make\n> git-completion.bash source a generated file.\n\nNicely analysed and summarized.  What kind of target audience are we\ntalking about?  What's the payoff vs cost comparison trying to\ncatering to those who install more recent completion script that\nrequires the --git-completion-helper option without using antient\nGit?\n\nIf the cutoff boundary is 2.17, that is more than year ago, and the\nboundary gets further and further in the past as time goes by. Also,\ndepending on how old the version of Git the target user runs, these\nhardcoded and manually listed options may not yet even exist in\ntheir binary.\n"},{"id":"377903","messageId":"xmqq5zouj3rl.fsf@gitster-ct.c.googlers.com","threadId":"51359","inReplyTo":"20190621223107.8022-15-felipe.contreras@gmail.com","subject":"Re: [PATCH 14/14] completion: add default merge strategies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-06-24T17:23:58Z","receivedAt":"2019-06-24T17:24:09Z","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> In case the command fails.\n\nIt is unclear what you wanted to say with this.  What command?\nAfter \"git merge\" fails?\n\n>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  contrib/completion/git-completion.bash | 4 +++-\n>  t/t9902-completion.sh                  | 2 +-\n>  2 files changed, 4 insertions(+), 2 deletions(-)\n>\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index 922ba5f925..91b87eb558 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -936,6 +936,7 @@ __git_list_merge_strategies ()\n>  \t}'\n>  }\n>  \n> +__git_merge_strategies_default='octopus ours recursive resolve subtree'\n>  __git_merge_strategies=\n>  # 'git merge -s help' (and thus detection of the merge strategy\n>  # list) fails, unfortunately, if run outside of any git working\n> @@ -945,7 +946,8 @@ __git_merge_strategies=\n>  __git_compute_merge_strategies ()\n>  {\n>  \ttest -n \"$__git_merge_strategies\" ||\n> -\t__git_merge_strategies=$(__git_list_merge_strategies)\n> +\t{ __git_merge_strategies=$(__git_list_merge_strategies);\n> +\t\t__git_merge_strategies=\"${__git_merge_strategies:-__git_merge_strategies_default}\"; }\n>  }\n>  \n>  __git_merge_strategy_options=\"ours theirs subtree subtree= patience\n> diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\n> index 14598bfbec..f4453ce70d 100755\n> --- a/t/t9902-completion.sh\n> +++ b/t/t9902-completion.sh\n> @@ -1722,7 +1722,7 @@ test_expect_success 'sourcing the completion script clears cached commands' '\n>  \tverbose test -z \"$__git_all_commands\"\n>  '\n>  \n> -test_expect_failure 'sourcing the completion script clears cached merge strategies' '\n> +test_expect_success 'sourcing the completion script clears cached merge strategies' '\n>  \toffgit &&\n>  \tGIT_TEST_GETTEXT_POISON= &&\n>  \t__git_compute_merge_strategies &&\n"},{"id":"377934","messageId":"CAMP44s0y_3Ltv_hnoVByTRwZrDU0+PfRo3R=Lxm6wDk+=sypJg@mail.gmail.com","threadId":"51359","inReplyTo":"xmqq5zouj3rl.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 14/14] completion: add default merge strategies","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-25T01:11:40Z","receivedAt":"2019-06-25T01:11:54Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Mon, Jun 24, 2019 at 12:24 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>\n> > In case the command fails.\n>\n> It is unclear what you wanted to say with this.  What command?\n> After \"git merge\" fails?\n\nYes. The command that __git_list_merge_strategies() uses.\n\n % cd /tmp\n % git merge -s help\nfatal: not a git repository (or any parent up to mount point /)\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\n\n-- \nFelipe Contreras\n"},{"id":"377935","messageId":"CAMP44s1hJZs3z=6aHJPzrbW05S=hmVE4RrcRBETzz7iCCqEPPg@mail.gmail.com","threadId":"51359","inReplyTo":"xmqqa7e6j3u1.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 13/14] completion: add default options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2019-06-25T01:38:25Z","receivedAt":"2019-06-25T01:38:38Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Mon, Jun 24, 2019 at 12:22 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Duy Nguyen <pclouds@gmail.com> writes:\n>\n> > On Sat, Jun 22, 2019 at 5:31 AM Felipe Contreras\n> > <felipe.contreras@gmail.com> wrote:\n> >>\n> >> Versions of Git older than v2.17 don't know about\n> >> --git-completion-helper, so provide some defaults for them.\n> > ...\n> >> +__gitcomp_builtin_add_default=\" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-\n> > removal --refresh --ignore-errors --ignore-missing --chmod=\n> > --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit\n> > --no-force --no-update --no-renormalize --no-intent-to-add --no-all\n> > --no-ignore-removal --no-refresh --no-ignore-errors\n> > --no-ignore-missing --no-chmod\"\n> >\n> > And who's going to keep these uptodate? If you do this, might as well\n> > delete --git-completion-helper\n> >\n> > A more acceptable option might be regenerate git-completion.bash and\n> > run --git-completion-helper to generate these, or make\n> > git-completion.bash source a generated file.\n>\n> Nicely analysed and summarized.  What kind of target audience are we\n> talking about?\n\nThe people that install their completion independently of their\ndistribution. A quick search in Stack Overflow shows hundreds of\nquestions, many related to Homebrew and Cygwin.\n\n> What's the payoff vs cost comparison trying to\n> catering to those who install more recent completion script that\n> requires the --git-completion-helper option without using antient\n> Git?\n\nYou use the adjective \"ancient\", but is it really? The current Ubuntu\nLTS release uses\n2.17.1, the previous one (supported until 2021) uses 2.7.4, the\ncurrent Debian stable uses 2.11.0, and the previous RHEL uses 2.3.5.\n\nTravis CI runs 2.15.1 by default.\n\nIf you are going to call these \"ancient\" what would you call the\ncurrent version in Debian oldstable? 2.1.4.\n\nNot everyone is a privileged as us.\n\n> If the cutoff boundary is 2.17, that is more than year ago, and the\n> boundary gets further and further in the past as time goes by. Also,\n> depending on how old the version of Git the target user runs, these\n> hardcoded and manually listed options may not yet even exist in\n> their binary.\n\nIndeed, the need for these defaults will diminish over time, but\n*right now* people are running versions of Git older than 2.17, for\nsure.\n\nAnd yes, it's possible that the completion will return an option that\ndoesn't exist yet in the user's version of Git, but historically that\nhas always been the case regarding Git completions (at least until\ngit-completion-helper).\n\nSo what would you rather have? a) return potentially non-existent\ncompletions, or b) don't complete anything?\n\nAnother idea I had is to have a separate 'git completion-helper'\ncommand that could act as a proxy for `git cmd\n--git-completion-helper` and `git --list-cmds`. The completion would\nthrow a warning if such command is missing, then, the person that\ninstalled the completion would have to find a suitable `git\ncompletion-helper` command. We could provide an \"example\" script that\ncontains all these defaults. People could modify this to generate the\ncorrect options for different Git versions. Realistically though, most\npeople will just use the defaults for the latest version, but at least\nthe responsibility is not on your side.\n\nCheers.\n\n-- \nFelipe Contreras\n"},{"id":"377936","messageId":"xmqq1rzih228.fsf@gitster-ct.c.googlers.com","threadId":"51359","inReplyTo":"CAMP44s0y_3Ltv_hnoVByTRwZrDU0+PfRo3R=Lxm6wDk+=sypJg@mail.gmail.com","subject":"Re: [PATCH 14/14] completion: add default merge strategies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-06-25T01:43:43Z","receivedAt":"2019-06-25T01:43:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> On Mon, Jun 24, 2019 at 12:24 PM Junio C Hamano <gitster@pobox.com> wrote:\n>>\n>> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>>\n>> > In case the command fails.\n>>\n>> It is unclear what you wanted to say with this.  What command?\n>> After \"git merge\" fails?\n>\n> Yes. The command that __git_list_merge_strategies() uses.\n\nNext round, write that in the proposed log message, please.  An\nissue in the proposed commit log message that puzzles reviewers is\nsomething we expect future readers of \"git log\" to also stumble on.\n\n>  % cd /tmp\n>  % git merge -s help\n> fatal: not a git repository (or any parent up to mount point /)\n> Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\n\nI think the recent <20190612085606.12144-1-pclouds@gmail.com>\nestablished a good pattern we should follow; when a command we run\nto get list of things to use in completion fails, we refrain from\ncaching that broken output, and arrange so that we will try again.\nIt looks to me that \"git merge -s help\" barfing outside a repository\nis a good candidate to follow that pattern.  Outside a repository,\nthe user will not be able to perform a merge with any strategy, so\nnot completing the command line when the user say \"git merge -s\n<TAB>\" outside a repository is not the end of the world, as long as\nwe follow the right codepath to grab the available strategies once\nthe user goes into a repository where \"git merge -s help\" works, no?\n\nThanks.\n"},{"id":"377937","messageId":"CACsJy8CLSPdS56O=hJM2FkVa5Qk4V2V_f-dSPMaBYARJLN1oNQ@mail.gmail.com","threadId":"51359","inReplyTo":"CAMP44s1hJZs3z=6aHJPzrbW05S=hmVE4RrcRBETzz7iCCqEPPg@mail.gmail.com","subject":"Re: [PATCH 13/14] completion: add default options","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2019-06-25T03:32:32Z","receivedAt":"2019-06-25T03:33:00Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Jun 25, 2019 at 8:38 AM Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n>\n> On Mon, Jun 24, 2019 at 12:22 PM Junio C Hamano <gitster@pobox.com> wrote:\n> >\n> > Duy Nguyen <pclouds@gmail.com> writes:\n> >\n> > > On Sat, Jun 22, 2019 at 5:31 AM Felipe Contreras\n> > > <felipe.contreras@gmail.com> wrote:\n> > >>\n> > >> Versions of Git older than v2.17 don't know about\n> > >> --git-completion-helper, so provide some defaults for them.\n> > > ...\n> > >> +__gitcomp_builtin_add_default=\" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-\n> > > removal --refresh --ignore-errors --ignore-missing --chmod=\n> > > --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit\n> > > --no-force --no-update --no-renormalize --no-intent-to-add --no-all\n> > > --no-ignore-removal --no-refresh --no-ignore-errors\n> > > --no-ignore-missing --no-chmod\"\n> > >\n> > > And who's going to keep these uptodate? If you do this, might as well\n> > > delete --git-completion-helper\n> > >\n> > > A more acceptable option might be regenerate git-completion.bash and\n> > > run --git-completion-helper to generate these, or make\n> > > git-completion.bash source a generated file.\n> >\n> > Nicely analysed and summarized.  What kind of target audience are we\n> > talking about?\n>\n> The people that install their completion independently of their\n> distribution. A quick search in Stack Overflow shows hundreds of\n> questions, many related to Homebrew and Cygwin.\n\nWhich could be answered with installing the right completion version.\nI don't think we make any promise of supporting \"old\" versions anyway\neven if used to work.\n\nI could see we add support to source/preload some generated shell\nscript, so that it works without --git-completion-helper [1]. But\nthat's about it, the generated scripts that contain all these\n__gitcomp_ variables can be packaged and maintained separately. Then\nyou could even have multiple completion packages for different git\nversions if you want. But I'd rather we (git.git devs) do not maintain\nthese generated variables by ourselves.\n\n[1] which may even gain interest from Windows crowd because there are\nfewer processes to run.\n-- \nDuy\n"},{"id":"378551","messageId":"20190703171433.GT21574@szeder.dev","threadId":"51359","inReplyTo":"CAMP44s0y_3Ltv_hnoVByTRwZrDU0+PfRo3R=Lxm6wDk+=sypJg@mail.gmail.com","subject":"Re: [PATCH 14/14] completion: add default merge strategies","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-07-03T17:14:33Z","receivedAt":"2019-07-03T17:14:39Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Mon, Jun 24, 2019 at 08:11:40PM -0500, Felipe Contreras wrote:\n> On Mon, Jun 24, 2019 at 12:24 PM Junio C Hamano <gitster@pobox.com> wrote:\n> >\n> > Felipe Contreras <felipe.contreras@gmail.com> writes:\n> >\n> > > In case the command fails.\n> >\n> > It is unclear what you wanted to say with this.  What command?\n> > After \"git merge\" fails?\n> \n> Yes. The command that __git_list_merge_strategies() uses.\n> \n>  % cd /tmp\n>  % git merge -s help\n> fatal: not a git repository (or any parent up to mount point /)\n> Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\n\nIf that command behind __git_list_merge_strategies() fails, then 'git\nmerge -s <TAB>' won't simply list any merge strategies.  However,\nthat's not a big deal, because the command won't work without a\nrepository anyway, so I don't see the point in adding a hard-coded\nlist of merge strategies.  And in this case $__git_merge_strategies\nwill remain empty, so the next time the user attempts to complete a\nstrategies while in a repository, then it will Just Work (unlike the\nundesired caching of options without a repository that is fixed in\n69702523af (completion: do not cache if --git-completion-helper fails,\n2019-06-12).\n\n"},{"id":"378552","messageId":"xmqqsgrn119k.fsf@gitster-ct.c.googlers.com","threadId":"51359","inReplyTo":"20190621223107.8022-13-felipe.contreras@gmail.com","subject":"Re: [PATCH 12/14] test: completion: use global config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-07-03T17:22:31Z","receivedAt":"2019-07-03T17:22:36Z","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> When appropriate.\n\nIt is unclear what makes these (but not other use of test_config)\nappropriate.\n\n>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  t/t9902-completion.sh | 10 +++++-----\n>  1 file changed, 5 insertions(+), 5 deletions(-)\n>\n> diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\n> index 7bef41eaf5..3dbfef6960 100755\n> --- a/t/t9902-completion.sh\n> +++ b/t/t9902-completion.sh\n> @@ -1497,9 +1497,9 @@ test_expect_success 'git --help completion' '\n>  \ttest_completion \"git --help core\" \"core-tutorial \"\n>  '\n>  \n> -test_expect_failure 'completion.commands removes multiple commands' '\n> +test_expect_success 'completion.commands removes multiple commands' '\n>  \toffgit &&\n> -\ttest_config completion.commands \"-cherry -mergetool\" &&\n> +\ttest_config_global completion.commands \"-cherry -mergetool\" &&\n\nThis feels more like fixing a bug introduced by step 11/14 in that\n(besides doing \"offgit\" that affects global test environment outside\na subshell) we want to do this test outside a repository so there is\nno appropriate \"local\" configuration \"git config\" (hence test_config)\ncan touch.  IOW, shouldn't this have been done in the step 11/14 when\n\"offgit\" was added?\n"},{"id":"378554","messageId":"xmqqo92b10it.fsf@gitster-ct.c.googlers.com","threadId":"51359","inReplyTo":"20190621223107.8022-12-felipe.contreras@gmail.com","subject":"Re: [PATCH 11/14] test: completion: tests for __gitcomp regression","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-07-03T17:38:34Z","receivedAt":"2019-07-03T17:38:42Z","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> +offgit ()\n> +{\n\nStyle: opening brace comes on the same line, like\n\n\toffgit () {\n\n\n> +\tGIT_CEILING_DIRECTORIES=\"$ROOT\" &&\n> +\texport GIT_CEILING_DIRECTORIES &&\n> +\ttest_when_finished \"ROOT='$ROOT'; cd '$TRASH_DIRECTORY'; unset GIT_CEILING_DIRECTORIES\" &&\n> +\tROOT=\"$ROOT\"/non-repo &&\n> +\tcd \"$ROOT\"\n> +}\n\nAll of these means that anytime some test uses offgit outside a\nsubshell, all the subsequent test will start from outside a\nrepository, with nonstandard GIT_CEILING_DIRECTORIES settings.\n\nThe test should avoid using this outside a subshell when able (and\nif it apparently cannot easily, we should try to find a way).\n\n> @@ -358,10 +367,8 @@ test_expect_success SYMLINKS '__git_find_repo_path - resulting path avoids symli\n>  '\n>  \n>  test_expect_success '__git_find_repo_path - not a git repository' '\n> +\toffgit &&\n>  \t(\n> -\t\tcd non-repo &&\n> -\t\tGIT_CEILING_DIRECTORIES=\"$ROOT\" &&\n> -\t\texport GIT_CEILING_DIRECTORIES &&\n>  \t\ttest_must_fail __git_find_repo_path &&\n>  \t\tprintf \"$__git_repo_path\" >\"$actual\"\n>  \t) &&\n> @@ -1388,6 +1395,7 @@ test_expect_success '__git_pretty_aliases' '\n>  '\n>  \n>  test_expect_success 'basic' '\n> +\toffgit &&\n>  \trun_completion \"git \" &&\n\nAdding \"offgit\" everywhere like this patch does means that this\n\"basic\" test, for example, no longer is performed in the condition\nwe have been testing the completion script for, doesn't it?  If so,\nthe patch is trading test coverage outside repo with coverage inside\nrepo, which is not a very good tradeoff.\n\n\n"},{"id":"378556","messageId":"20190703174909.GU21574@szeder.dev","threadId":"51359","inReplyTo":"20190621223107.8022-12-felipe.contreras@gmail.com","subject":"Re: [PATCH 11/14] test: completion: tests for __gitcomp regression","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-07-03T17:49:09Z","receivedAt":"2019-07-03T17:49:16Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Fri, Jun 21, 2019 at 05:31:04PM -0500, Felipe Contreras wrote:\n> There's a regression in the completion since the introduction of\n> __gitcomp.\n> \n> Go to any directory that doesn't contain a git repository, like /tmp.\n> Then type the following:\n> \n>   git checkout --<tab>\n> \n> You will see nothing. That's because\n> `git checkout --git-completion-helper` fails when you run it outside a\n> git repository.\n> \n> You might change to a directory that has a git repository, but it's too\n> late, because the empty options have been cached.\n\nThis will get outdated rather soonish, as soon as 69702523af\n(completion: do not cache if --git-completion-helper fails,\n2019-06-12) graduates to master.\n\n> It's unclear how many commands are affected, but this patch attempts to\n> at least detect some already in the testing framework.\n\nIt seems that several changes in this patch modify tests in a way that\ndefeats the purpose of the given test, e.g. the tests\n'completion.commands removes multiple commands' or 'sourcing the\ncompletion script clears cached merge strategies'\n\nI would rather see tests specifically focusing on the\n__gitcomp_builtin() helper function, including test cases when it's\nexcersized outside of a repository and when it gets additional\nparameters to include and exclude some options.\n\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  t/t9902-completion.sh | 37 ++++++++++++++++++++++++++++---------\n>  1 file changed, 28 insertions(+), 9 deletions(-)\n> \n> diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\n> index 43cf313a1c..7bef41eaf5 100755\n> --- a/t/t9902-completion.sh\n> +++ b/t/t9902-completion.sh\n> @@ -122,6 +122,15 @@ test_gitcomp_nl ()\n>  \ttest_cmp expected out\n>  }\n>  \n> +offgit ()\n> +{\n> +\tGIT_CEILING_DIRECTORIES=\"$ROOT\" &&\n> +\texport GIT_CEILING_DIRECTORIES &&\n> +\ttest_when_finished \"ROOT='$ROOT'; cd '$TRASH_DIRECTORY'; unset GIT_CEILING_DIRECTORIES\" &&\n> +\tROOT=\"$ROOT\"/non-repo &&\n> +\tcd \"$ROOT\"\n\nI think fiddling with $ROOT is unnecessary here.\n\n> +}\n> +\n>  invalid_variable_name='${foo.bar}'\n>  \n>  actual=\"$TRASH_DIRECTORY/actual\"\n> @@ -358,10 +367,8 @@ test_expect_success SYMLINKS '__git_find_repo_path - resulting path avoids symli\n>  '\n>  \n>  test_expect_success '__git_find_repo_path - not a git repository' '\n> +\toffgit &&\n>  \t(\n> -\t\tcd non-repo &&\n> -\t\tGIT_CEILING_DIRECTORIES=\"$ROOT\" &&\n> -\t\texport GIT_CEILING_DIRECTORIES &&\n>  \t\ttest_must_fail __git_find_repo_path &&\n>  \t\tprintf \"$__git_repo_path\" >\"$actual\"\n>  \t) &&\n> @@ -1388,6 +1395,7 @@ test_expect_success '__git_pretty_aliases' '\n>  '\n>  \n>  test_expect_success 'basic' '\n> +\toffgit &&\n>  \trun_completion \"git \" &&\n>  \t# built-in\n>  \tgrep -q \"^add \\$\" out &&\n> @@ -1401,6 +1409,7 @@ test_expect_success 'basic' '\n>  '\n>  \n>  test_expect_success 'double dash \"git\" itself' '\n> +\toffgit &&\n>  \ttest_completion \"git --\" <<-\\EOF\n>  \t--paginate Z\n>  \t--no-pager Z\n> @@ -1419,7 +1428,8 @@ test_expect_success 'double dash \"git\" itself' '\n>  \tEOF\n>  '\n>  \n> -test_expect_success 'double dash \"git checkout\"' '\n> +test_expect_failure 'double dash \"git checkout\"' '\n> +\toffgit &&\n>  \ttest_completion \"git checkout --\" <<-\\EOF\n>  \t--quiet Z\n>  \t--detach Z\n> @@ -1442,6 +1452,7 @@ test_expect_success 'double dash \"git checkout\"' '\n>  '\n>  \n>  test_expect_success 'general options' '\n> +\toffgit &&\n>  \ttest_completion \"git --ver\" \"--version \" &&\n>  \ttest_completion \"git --hel\" \"--help \" &&\n>  \ttest_completion \"git --exe\" <<-\\EOF &&\n> @@ -1460,6 +1471,7 @@ test_expect_success 'general options' '\n>  '\n>  \n>  test_expect_success 'general options plus command' '\n> +\toffgit &&\n>  \ttest_completion \"git --version check\" \"checkout \" &&\n>  \ttest_completion \"git --paginate check\" \"checkout \" &&\n>  \ttest_completion \"git --git-dir=foo check\" \"checkout \" &&\n> @@ -1480,11 +1492,13 @@ test_expect_success 'general options plus command' '\n>  '\n>  \n>  test_expect_success 'git --help completion' '\n> +\toffgit &&\n>  \ttest_completion \"git --help ad\" \"add \" &&\n>  \ttest_completion \"git --help core\" \"core-tutorial \"\n>  '\n>  \n> -test_expect_success 'completion.commands removes multiple commands' '\n> +test_expect_failure 'completion.commands removes multiple commands' '\n> +\toffgit &&\n>  \ttest_config completion.commands \"-cherry -mergetool\" &&\n>  \tgit --list-cmds=list-mainporcelain,list-complete,config >out &&\n>  \t! grep -E \"^(cherry|mergetool)$\" out\n> @@ -1547,9 +1561,10 @@ test_expect_success 'complete tree filename with metacharacters' '\n>  \tEOF\n>  '\n>  \n> -test_expect_success PERL 'send-email' '\n> -\ttest_completion \"git send-email --cov\" \"--cover-letter \" &&\n> -\ttest_completion \"git send-email ma\" \"master \"\n> +test_expect_failure PERL 'send-email' '\n> +\ttest_completion \"git send-email ma\" \"master \" &&\n> +\toffgit &&\n> +\ttest_completion \"git send-email --cov\" \"--cover-letter \"\n>  '\n>  \n>  test_expect_success 'complete files' '\n> @@ -1649,6 +1664,7 @@ test_expect_success 'completion used <cmd> completion for alias: !f() { : git <c\n>  '\n>  \n>  test_expect_success 'completion without explicit _git_xxx function' '\n> +\toffgit &&\n>  \ttest_completion \"git version --\" <<-\\EOF\n>  \t--build-options Z\n>  \t--no-build-options Z\n> @@ -1699,13 +1715,15 @@ do\n>  done\n>  \n>  test_expect_success 'sourcing the completion script clears cached commands' '\n> +\toffgit &&\n>  \t__git_compute_all_commands &&\n>  \tverbose test -n \"$__git_all_commands\" &&\n>  \t. \"$GIT_BUILD_DIR/contrib/completion/git-completion.bash\" &&\n>  \tverbose test -z \"$__git_all_commands\"\n>  '\n>  \n> -test_expect_success 'sourcing the completion script clears cached merge strategies' '\n> +test_expect_failure 'sourcing the completion script clears cached merge strategies' '\n> +\toffgit &&\n>  \tGIT_TEST_GETTEXT_POISON= &&\n>  \t__git_compute_merge_strategies &&\n>  \tverbose test -n \"$__git_merge_strategies\" &&\n> @@ -1714,6 +1732,7 @@ test_expect_success 'sourcing the completion script clears cached merge strategi\n>  '\n>  \n>  test_expect_success 'sourcing the completion script clears cached --options' '\n> +\toffgit &&\n>  \t__gitcomp_builtin checkout &&\n>  \tverbose test -n \"$__gitcomp_builtin_checkout\" &&\n>  \t__gitcomp_builtin notes_edit &&\n> -- \n> 2.22.0\n> \n"},{"id":"378557","messageId":"xmqqk1cz0zz1.fsf@gitster-ct.c.googlers.com","threadId":"51359","inReplyTo":"20190621223107.8022-1-felipe.contreras@gmail.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-07-03T17:50:26Z","receivedAt":"2019-07-03T17:50:37Z","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> Here's another try at completion fixes, cleanups, and more tests. Some\n> of these have already been sent.\n>\n> Felipe Contreras (14):\n>   completion: zsh: fix __gitcomp_direct()\n>   completion: zsh: fix for directories with spaces\n>   completion: remove zsh hack\n>   completion: zsh: improve main function selection\n>   completion: prompt: fix color for Zsh\n>   completion: bash: cleanup cygwin check\n>   completion: zsh: update installation instructions\n>   completion: bash: remove old compat wrappers\n>   completion: bash: remove zsh wrapper\n>   completion: zsh: trivial cleanups\n>   test: completion: tests for __gitcomp regression\n>   test: completion: use global config\n>   completion: add default options\n>   completion: add default merge strategies\n>\n>  contrib/completion/git-completion.bash | 202 +++++++++++++------------\n>  contrib/completion/git-completion.zsh  |  53 +++----\n>  contrib/completion/git-prompt.sh       |  10 +-\n>  t/t9902-completion.sh                  |  37 +++--\n>  4 files changed, 161 insertions(+), 141 deletions(-)\n\nHaving scanned the discussion threads so far, I think the last four\npatches are going against the list consensus of (1) it is OK to rely\non --git-completion-helper; using ancient Git with new completion\nscript won't obviously work, but that is \"if it hurts, don't\". (2)\nsome subcommands will fail the --git-completion-helper request\n(e.g. outside a repository), but as long as the output from failed\nrequest is not cached, it is OK.\n\nBut we haven't seen any response to the earlier zsh specific\npatches.  Does it mean that nobody other than Felipe cares about\nhaving a working Git completion for zsh?  Or does it mean that all\nusers other than Felipe are happy with the current Git completion\nfor zsh and it works very well for them already?  Or somewhere in\nbetween?\n\nWhat I am trying to get at is if we would want to keep the earlier\nzsh parts of the series, but with nobody seemingly interested in, it\nis hard for me to justify queuing them.\n\nThanks.\n"},{"id":"378568","messageId":"20190703190639.GA20404@szeder.dev","threadId":"51359","inReplyTo":"xmqqk1cz0zz1.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-07-03T19:06:39Z","receivedAt":"2019-07-03T19:06:48Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Wed, Jul 03, 2019 at 10:50:26AM -0700, Junio C Hamano wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n> \n> > Here's another try at completion fixes, cleanups, and more tests. Some\n> > of these have already been sent.\n> >\n> > Felipe Contreras (14):\n> >   completion: zsh: fix __gitcomp_direct()\n> >   completion: zsh: fix for directories with spaces\n> >   completion: remove zsh hack\n> >   completion: zsh: improve main function selection\n> >   completion: prompt: fix color for Zsh\n> >   completion: bash: cleanup cygwin check\n> >   completion: zsh: update installation instructions\n> >   completion: bash: remove old compat wrappers\n> >   completion: bash: remove zsh wrapper\n> >   completion: zsh: trivial cleanups\n> >   test: completion: tests for __gitcomp regression\n> >   test: completion: use global config\n> >   completion: add default options\n> >   completion: add default merge strategies\n> >\n> >  contrib/completion/git-completion.bash | 202 +++++++++++++------------\n> >  contrib/completion/git-completion.zsh  |  53 +++----\n> >  contrib/completion/git-prompt.sh       |  10 +-\n> >  t/t9902-completion.sh                  |  37 +++--\n> >  4 files changed, 161 insertions(+), 141 deletions(-)\n> \n> Having scanned the discussion threads so far, I think the last four\n> patches are going against the list consensus of (1) it is OK to rely\n> on --git-completion-helper; using ancient Git with new completion\n> script won't obviously work, but that is \"if it hurts, don't\". (2)\n> some subcommands will fail the --git-completion-helper request\n> (e.g. outside a repository), but as long as the output from failed\n> request is not cached, it is OK.\n> \n> But we haven't seen any response to the earlier zsh specific\n> patches.  Does it mean that nobody other than Felipe cares about\n> having a working Git completion for zsh?  Or does it mean that all\n> users other than Felipe are happy with the current Git completion\n> for zsh and it works very well for them already?  Or somewhere in\n> between?\n> \n> What I am trying to get at is if we would want to keep the earlier\n> zsh parts of the series, but with nobody seemingly interested in, it\n> is hard for me to justify queuing them.\n\nI'm not a Zsh user and am mostly unfamiliar with its antics, but\nFWIW...\n\nZsh has its own git completion routines, which are in some aspects\nmore advanced than what can be achieved with Bash's completion\nfacilities (or more wasteful in screen real estate, depending on your\npreferences :), e.g. Zsh's completion shows a short description for\neach completeable --option and whatnot).  I suppose that the avarage\nZsh & Git user uses Zsh's own git completion instead of our Bash\ncompletion script wrapped for Zsh.\n\nHaving said that, I applied the first 7 patches in my tree and then\nfollowed the updated installation instructions, and it finally worked.\nI remember trying it in the past once or twice, to check whether some\nof my bigger completion updates break something in Zsh, but it never\nworked.  So these patches (and perhaps patch 10 as well) seem to be a\ndefinite improvement (though admittedly I haven't tested them\nthoroughly).\n\nAs for the latter part of the series, I think the more hard-coded\noptions we can get rid of the better we are off, and I would rather\nnot see them making a comeback.  I don't really have an opinion about\npatches 8 and 9 (that old wrapper is probably just bitrotting away,\nbut I just tried to source our bash completion script from Zsh, and\napart from the deprecation warning it appeared to work).\n\n"},{"id":"408339","messageId":"CAMP44s3wqxTmgQpMgk2cM33EvtwrvvXYv4_90GKGmHb8yJHAKg@mail.gmail.com","threadId":"51359","inReplyTo":"xmqqk1cz0zz1.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:46:19Z","receivedAt":"2020-10-25T03:46:33Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, Jul 3, 2019 at 12:50 PM Junio C Hamano <gitster@pobox.com> wrote:\n\n> But we haven't seen any response to the earlier zsh specific\n> patches.  Does it mean that nobody other than Felipe cares about\n> having a working Git completion for zsh?  Or does it mean that all\n> users other than Felipe are happy with the current Git completion\n> for zsh and it works very well for them already?  Or somewhere in\n> between?\n\nThe answer is obvious: the set of zsh users and the set of git\ndevelopers don't overlap.\n\n> What I am trying to get at is if we would want to keep the earlier\n> zsh parts of the series, but with nobody seemingly interested in, it\n> is hard for me to justify queuing them.\n\nYou are asking in the wrong forum.\n\nI would gladly point you to *dozens* of issues reported in Stack\nOverflow and Oh-My-Zsh if you don't believe me.\n\nOr you could just install zsh and see the issues for yourself.\n\n-- \nFelipe Contreras\n"},{"id":"408340","messageId":"CAMP44s11BtC8uf11PqDe9ZwVGNHhyjh4usWHBc6giC4ydj+xdg@mail.gmail.com","threadId":"51359","inReplyTo":"20190703190639.GA20404@szeder.dev","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-25T03:51:07Z","receivedAt":"2020-10-25T03:51:28Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, Jul 3, 2019 at 2:06 PM SZEDER Gábor <szeder.dev@gmail.com> wrote:\n\n> As for the latter part of the series, I think the more hard-coded\n> options we can get rid of the better we are off, and I would rather\n> not see them making a comeback.  I don't really have an opinion about\n> patches 8 and 9 (that old wrapper is probably just bitrotting away,\n> but I just tried to source our bash completion script from Zsh, and\n> apart from the deprecation warning it appeared to work).\n\nI just added those patches to highlight the issue, which is very real,\nand you can see by running the added tests.\n\nI will maintain those patches separately in a branch named \"hacks\" in\nmy project git-completion. If anybody wants the latest completion with\nan old version of Git they can use my project instead.\n\nhttps://github.com/felipec/git-completion/commits/hacks\n\n-- \nFelipe Contreras\n"},{"id":"408527","messageId":"xmqqk0vbbep5.fsf@gitster.c.googlers.com","threadId":"51359","inReplyTo":"CAMP44s3wqxTmgQpMgk2cM33EvtwrvvXYv4_90GKGmHb8yJHAKg@mail.gmail.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-27T20:23:50Z","receivedAt":"2020-10-27T20:23:59Z","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>> What I am trying to get at is if we would want to keep the earlier\n>> zsh parts of the series, but with nobody seemingly interested in, it\n>> is hard for me to justify queuing them.\n>\n> You are asking in the wrong forum.\n>\n> I would gladly point you to *dozens* of issues reported in Stack\n> Overflow and Oh-My-Zsh if you don't believe me.\n\nOh, no, there is no \"believing\" needed.\n\nHave you fed your patches to those folks who have dozens of issues\nand the patches made their life better?  It does not help much to\nmake me look at these forums; we need some way to make those in\nthese forums aware of your improvements, try them out and report\nsuccess, to help the wider range of users who are not even in these\nforums and struggling with their zsh-completion use (they will get\ntheir zsh/git completion from their distros---I am assuming that the\ndistros get theirs from us in contrib/completion/).\n\n> Or you could just install zsh and see the issues for yourself.\n\nNo, thanks.  I am not a zsh user, and have no plan to become one ;-)\n"},{"id":"408538","messageId":"CAMP44s13nip2_Z1OOFb9iVcrSxQbyJW4cH86J3Ah1p4SmTQWQQ@mail.gmail.com","threadId":"51359","inReplyTo":"xmqqk0vbbep5.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-27T22:19:05Z","receivedAt":"2020-10-27T22:19:25Z","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:23 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> > You are asking in the wrong forum.\n> >\n> > I would gladly point you to *dozens* of issues reported in Stack\n> > Overflow and Oh-My-Zsh if you don't believe me.\n>\n> Oh, no, there is no \"believing\" needed.\n>\n> Have you fed your patches to those folks who have dozens of issues\n> and the patches made their life better?\n\nYes.\n\n> It does not help much to\n> make me look at these forums; we need some way to make those in\n> these forums aware of your improvements, try them out and report\n> success,\n\nThey already are, and they already have. In those forums.\n\n> (they will get\n> their zsh/git completion from their distros---I am assuming that the\n> distros get theirs from us in contrib/completion/).\n\nI don't know of anyone that relies on the zsh completion shared by\ntheir distribution.\n\n> > Or you could just install zsh and see the issues for yourself.\n>\n> No, thanks.  I am not a zsh user, and have no plan to become one ;-)\n\nYou don't need to become a zsh user to test a patch. I often test bash\ncompletion patches on bash, even though I'm not a bash user.\n\nCheers.\n\n-- \nFelipe Contreras\n"},{"id":"408545","messageId":"CAMP44s0nxQ8jxxw7wSPOMv9Nx1P7ww3S6dGv27xNVQ_aHTaPng@mail.gmail.com","threadId":"51359","inReplyTo":"xmqqr1pj9rf0.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T00:06:24Z","receivedAt":"2020-10-28T01:47: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 5:32 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> >> (they will get\n> >> their zsh/git completion from their distros---I am assuming that the\n> >> distros get theirs from us in contrib/completion/).\n> >\n> > I don't know of anyone that relies on the zsh completion shared by\n> > their distribution.\n>\n> Hmph.  If the real users don't get the completion scripts from their\n> distribution, is there still a point in having them in my tree?  You\n> are certainly not suggesting me to remove contrib/completion/ at\n> least for zsh part, but then it is unclear what you want.\n\nI didn't say the users didn't get the scripts from the distribution, I\nsaid I didn't know of anyone that did. I just checked the installation\ninstructions of Homebrew, and they do seem to install the zsh\ncompletion from contrib, whoever, by the time I see the bug reports,\nthose users already downloaded the most recent version from GitHub\n[1].\n\nOn the other hand my distribution (Arch Linux) does not enable the zsh\nscript by default, it just lies dormant in /usr/share/git/completion,\nwhich nobody uses. So users in Arch Linux naturally would download the\nlatest version from GitHub [1] as well.\n\nSo, which distributions package and enable the zsh script by default? Who knows.\n\nI suggested you to graduate those scripts out of contrib so\ndistributions would trust the scripts enough to enable them by\ndefault, but you refused.\n\nWhat you do with the scripts is up to you, I only know what would\nhappen depending on what you do. 1) If you leave them as is, some\ndistributions would enable them, others don't, and people will keep\ndownloading the scripts from git's GitHub [1]. 2) If you graduate\nthem, more--if not all--distributions would enable them by default,\nand less people would download them. 3) If you remove them, people\nwould look for another git repository to download those scripts from.\n\n> Are you saying that by adding the latest and greatest, these real\n> users who so far couldn't rely on distros now can start to do so,\n> and we'll make their life easier by updating the 29-patch series\n> (which I presume is the v2 of this 14-patch series)?\n\nNo. Many of them will keep downloading the completion from git's\nmirror in GitHub [1].\n\nUnless you graduate the scripts out of contrib.\n\n> In any case, some Zsh users, even though they are not active\n> developers for the completion script, may have something good to\n> say, now the 29-patch series has been posted to the list and queued.\n> I didn't look at the zsh part, but I didn't find anything glaringly\n> wrong in the changes to the bash completion.\n\nThat's great. Although I have v3 already, since I found a couple of issues.\n\nI'll send those.\n\nCheers.\n\n[1] https://github.com/git/git/blob/master/contrib/completion/git-completion.zsh\n\n-- \nFelipe Contreras\n"},{"id":"408549","messageId":"xmqqr1pj9rf0.fsf@gitster.c.googlers.com","threadId":"51359","inReplyTo":"CAMP44s13nip2_Z1OOFb9iVcrSxQbyJW4cH86J3Ah1p4SmTQWQQ@mail.gmail.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-27T23:32:03Z","receivedAt":"2020-10-28T01:48:08Z","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>> Have you fed your patches to those folks who have dozens of issues\n>> and the patches made their life better?\n>\n> Yes.\n\nThat's good.\n\n>> (they will get\n>> their zsh/git completion from their distros---I am assuming that the\n>> distros get theirs from us in contrib/completion/).\n>\n> I don't know of anyone that relies on the zsh completion shared by\n> their distribution.\n\nHmph.  If the real users don't get the completion scripts from their\ndistribution, is there still a point in having them in my tree?  You\nare certainly not suggesting me to remove contrib/completion/ at\nleast for zsh part, but then it is unclear what you want.\n\nAre you saying that by adding the latest and greatest, these real\nusers who so far couldn't rely on distros now can start to do so,\nand we'll make their life easier by updating the 29-patch series\n(which I presume is the v2 of this 14-patch series)?\n\nIn any case, some Zsh users, even though they are not active\ndevelopers for the completion script, may have something good to\nsay, now the 29-patch series has been posted to the list and queued.\nI didn't look at the zsh part, but I didn't find anything glaringly\nwrong in the changes to the bash completion.\n\nThanks.\n"},{"id":"408565","messageId":"CAMP44s0+TMhmPYM7omoFhcebMLhZyh6v77WUFNrscRtPNEDNHQ@mail.gmail.com","threadId":"51359","inReplyTo":"0ec43318-bf83-25c4-a817-a150e2e47546@haller-berlin.de","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-10-28T16:31:06Z","receivedAt":"2020-10-28T22:17:19Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, Oct 28, 2020 at 3:09 AM Stefan Haller <lists@haller-berlin.de> wrote:\n>\n> On 28.10.20 1:06, Felipe Contreras wrote:\n\n> > I didn't say the users didn't get the scripts from the distribution, I\n> > said I didn't know of anyone that did. I just checked the installation\n> > instructions of Homebrew, and they do seem to install the zsh\n> > completion from contrib, whoever, by the time I see the bug reports,\n> > those users already downloaded the most recent version from GitHub\n> > [1].\n>\n> I might not be the representative zsh user, but just as one data point:\n> I have never downloaded the completion scripts from anywhere. I always\n> use the one that comes with my \"distro\" (which is the Mac git installer,\n> most of the time, which puts it in /usr/local/git/contrib/completion/).\n> I symlink that to ~/.zfunc/_git.\n\nThat's interesting. Where did you get the idea to do that?\n\n> > On the other hand my distribution (Arch Linux) does not enable the zsh\n> > script by default, it just lies dormant in /usr/share/git/completion,\n> > which nobody uses. So users in Arch Linux naturally would download the\n> > latest version from GitHub [1] as well.\n> >\n> > So, which distributions package and enable the zsh script by default? Who knows.\n> >\n> > I suggested you to graduate those scripts out of contrib so\n> > distributions would trust the scripts enough to enable them by\n> > default, but you refused.\n> >\n> > What you do with the scripts is up to you, I only know what would\n> > happen depending on what you do. 1) If you leave them as is, some\n> > distributions would enable them, others don't, and people will keep\n> > downloading the scripts from git's GitHub [1]. 2) If you graduate\n> > them, more--if not all--distributions would enable them by default,\n> > and less people would download them. 3) If you remove them, people\n> > would look for another git repository to download those scripts from.\n>\n> I don't think it makes a difference whether the scripts live in contrib\n> or not. Bash completion is also in contrib, and yet it seems to be\n> shipped and enabled by most distros, as far as I can tell.\n\nApples and oranges.\n\nThere is no default completion for git in bash, neither in bash, nor\nin bash-completion, so if the distribution doesn't install the\ncompletion in the right place\n(/usr/share/bash-completion/completions/git), then the user would have\nno git completion.\n\nOn zsh the situation is different; zsh by default has a git completion\n(/usr/share/zsh/functions/Completion/Unix/_git), and some might argue\nit's more complete than git's zsh completion, so why would\ndistribution maintainers chose the one in 'contrib' (an unofficial\ncontributed script) over the official one? Indeed they don't, at least\non Arch Linux.\n\nCheers.\n\n-- \nFelipe Contreras\n"},{"id":"408606","messageId":"f4c942e1-6ac0-6caf-cbc7-d25a73b749fa@haller-berlin.de","threadId":"51359","inReplyTo":"CAMP44s0+TMhmPYM7omoFhcebMLhZyh6v77WUFNrscRtPNEDNHQ@mail.gmail.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2020-10-28T17:34:20Z","receivedAt":"2020-10-29T00:34:26Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"On 28.10.20 17:31, Felipe Contreras wrote:\n> On Wed, Oct 28, 2020 at 3:09 AM Stefan Haller <lists@haller-berlin.de> wrote:\n>>\n>> On 28.10.20 1:06, Felipe Contreras wrote:\n> \n>>> I didn't say the users didn't get the scripts from the distribution, I\n>>> said I didn't know of anyone that did. I just checked the installation\n>>> instructions of Homebrew, and they do seem to install the zsh\n>>> completion from contrib, whoever, by the time I see the bug reports,\n>>> those users already downloaded the most recent version from GitHub\n>>> [1].\n>>\n>> I might not be the representative zsh user, but just as one data point:\n>> I have never downloaded the completion scripts from anywhere. I always\n>> use the one that comes with my \"distro\" (which is the Mac git installer,\n>> most of the time, which puts it in /usr/local/git/contrib/completion/).\n>> I symlink that to ~/.zfunc/_git.\n> \n> That's interesting. Where did you get the idea to do that?\n\n From the documentation in git-completion.zsh. I must have set this up \nat a time where the documentation was still correct (i.e. before it got \nbroken in <https://github.com/gitster/git/commit/176f5adfdb01a>.\n\n-Stefan\n"},{"id":"408609","messageId":"0ec43318-bf83-25c4-a817-a150e2e47546@haller-berlin.de","threadId":"51359","inReplyTo":"CAMP44s0nxQ8jxxw7wSPOMv9Nx1P7ww3S6dGv27xNVQ_aHTaPng@mail.gmail.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2020-10-28T09:09:28Z","receivedAt":"2020-10-29T01:10:05Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"On 28.10.20 1:06, Felipe Contreras wrote:\n> On Tue, Oct 27, 2020 at 5:32 PM Junio C Hamano <gitster@pobox.com> wrote:\n>>\n>> Felipe Contreras <felipe.contreras@gmail.com> writes:\n> \n>>>> (they will get\n>>>> their zsh/git completion from their distros---I am assuming that the\n>>>> distros get theirs from us in contrib/completion/).\n>>>\n>>> I don't know of anyone that relies on the zsh completion shared by\n>>> their distribution.\n>>\n>> Hmph.  If the real users don't get the completion scripts from their\n>> distribution, is there still a point in having them in my tree?  You\n>> are certainly not suggesting me to remove contrib/completion/ at\n>> least for zsh part, but then it is unclear what you want.\n> \n> I didn't say the users didn't get the scripts from the distribution, I\n> said I didn't know of anyone that did. I just checked the installation\n> instructions of Homebrew, and they do seem to install the zsh\n> completion from contrib, whoever, by the time I see the bug reports,\n> those users already downloaded the most recent version from GitHub\n> [1].\n\nI might not be the representative zsh user, but just as one data point: \nI have never downloaded the completion scripts from anywhere. I always \nuse the one that comes with my \"distro\" (which is the Mac git installer, \nmost of the time, which puts it in /usr/local/git/contrib/completion/). \nI symlink that to ~/.zfunc/_git.\n\n> On the other hand my distribution (Arch Linux) does not enable the zsh\n> script by default, it just lies dormant in /usr/share/git/completion,\n> which nobody uses. So users in Arch Linux naturally would download the\n> latest version from GitHub [1] as well.\n> \n> So, which distributions package and enable the zsh script by default? Who knows.\n> \n> I suggested you to graduate those scripts out of contrib so\n> distributions would trust the scripts enough to enable them by\n> default, but you refused.\n> \n> What you do with the scripts is up to you, I only know what would\n> happen depending on what you do. 1) If you leave them as is, some\n> distributions would enable them, others don't, and people will keep\n> downloading the scripts from git's GitHub [1]. 2) If you graduate\n> them, more--if not all--distributions would enable them by default,\n> and less people would download them. 3) If you remove them, people\n> would look for another git repository to download those scripts from.\n\nI don't think it makes a difference whether the scripts live in contrib \nor not. Bash completion is also in contrib, and yet it seems to be \nshipped and enabled by most distros, as far as I can tell.\n\nI guess the reason why zsh completion is not enabled by default in \ndistros is simply that there are far fewer zsh users than bash users, so \npackagers don't bother. That's just my unfounded guess, of course.\n\n>> Are you saying that by adding the latest and greatest, these real\n>> users who so far couldn't rely on distros now can start to do so,\n>> and we'll make their life easier by updating the 29-patch series\n>> (which I presume is the v2 of this 14-patch series)?\n> \n> No. Many of them will keep downloading the completion from git's\n> mirror in GitHub [1].\n> \n> Unless you graduate the scripts out of contrib.\n> \n>> In any case, some Zsh users, even though they are not active\n>> developers for the completion script, may have something good to\n>> say, now the 29-patch series has been posted to the list and queued.\n>> I didn't look at the zsh part, but I didn't find anything glaringly\n>> wrong in the changes to the bash completion.\n> \n> That's great. Although I have v3 already, since I found a couple of issues.\n> \n> I'll send those.\n> \n> Cheers.\n> \n> [1] https://github.com/git/git/blob/master/contrib/completion/git-completion.zsh\n> \n"},{"id":"408649","messageId":"xmqqeelh7y23.fsf@gitster.c.googlers.com","threadId":"51359","inReplyTo":"CAMP44s0+TMhmPYM7omoFhcebMLhZyh6v77WUFNrscRtPNEDNHQ@mail.gmail.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-29T17:16:04Z","receivedAt":"2020-10-29T17:16:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> On Wed, Oct 28, 2020 at 3:09 AM Stefan Haller <lists@haller-berlin.de> wrote:\n>>\n>> I might not be the representative zsh user, but just as one data point:\n>> I have never downloaded the completion scripts from anywhere. I always\n>> use the one that comes with my \"distro\" (which is the Mac git installer,\n>> most of the time, which puts it in /usr/local/git/contrib/completion/).\n>> I symlink that to ~/.zfunc/_git.\n\nThat's one data point.\n\n>> I don't think it makes a difference whether the scripts live in contrib\n>> or not. Bash completion is also in contrib, and yet it seems to be\n>> shipped and enabled by most distros, as far as I can tell.\n>\n> Apples and oranges.\n>\n> There is no default completion for git in bash, neither in bash, nor\n> in bash-completion, so if the distribution doesn't install the\n> completion in the right place\n> (/usr/share/bash-completion/completions/git), then the user would have\n> no git completion.\n\nTrue, as far as I know.  https://github.com/scop/bash-completion does not\nseem to have an entry for \"git\" (/usr/share/bash-completion/completions/git\nhowever is locally there on my box---probably the corp IT folks installed\nit there), so what we ship in contrib/ is the most used (if not the only)\nimplementation of bash completion script.\n\n> On zsh the situation is different; zsh by default has a git completion\n> (/usr/share/zsh/functions/Completion/Unix/_git), and some might argue\n> it's more complete than git's zsh completion,\n\nHow is that completion script developed, maintained and distributed?\n\nBy \"by default\" I believe you mean that it gets installed when you\ninstall zsh automatically.  Is the situation different on macOS land\n(which I can believe, unfortunately)?\n\nStefan?  If at least some people argue what comes with zsh by\ndefault is more complete than the one we have in contrib/, what led\nyou choose to \"symlink\" the less complete one to use it instead?\n\nAnother question (this is for Felipe).  Is\n\n  https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/gitfast\n\nthe one that comes with zsh by default, or is it something else\n(perhaps it is the go-to version for those who are not satisfied\nwith the version that comes with zsh by default???)?\n\nThanks.\n"},{"id":"408650","messageId":"xmqq361x7xj5.fsf@gitster.c.googlers.com","threadId":"51359","inReplyTo":"xmqqeelh7y23.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-29T17:27:26Z","receivedAt":"2020-10-29T17:27:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>\n>> On zsh the situation is different; zsh by default has a git completion\n>> (/usr/share/zsh/functions/Completion/Unix/_git), and some might argue\n>> it's more complete than git's zsh completion,\n>\n> How is that completion script developed, maintained and distributed?\n>\n> By \"by default\" I believe you mean that it gets installed when you\n> install zsh automatically.  Is the situation different on macOS land\n> (which I can believe, unfortunately)?\n> ...\n\nWeb searching for \"zsh git autocompletion\" gave a few interesting insights.\n\n - https://medium.com/@oliverspryn/adding-git-completion-to-zsh-60f3b0e7ffbc\n   was the first hit, which is about how to use what we ship in contrib/\n\n - https://stackoverflow.com/questions/24513873/ which was near the top\n   had these gems.\n\n      https://stackoverflow.com/a/58517668\n      Actually, ZSH does know how to do git completion out of the box, but\n      you need to turn on the completion feature itself (which from the\n      steps you described I guess you haven't done)\n\n   and\n\n      https://stackoverflow.com/a/63894520\n      Turns out the problem for me wass that when installing git via\n      homebrew, git installs its own zsh shell extension which is\n      considerably less complete/capable than the default that\n      oh-my-szh installs. Find out what versions your git install is\n      and then remove the zsh autocompletions. Mine were here and\n      deleted thusly:\n\n\trm -rf /usr/local/Cellar/git/2.28.0/share/zsh/\n\nThe \"knows out of the box\" in https://stackoverflow.com/a/58517668\nis matches your \"zsh by default has\".\n\n> so why would\n> distribution maintainers chose the one in 'contrib' (an unofficial\n> contributed script) over the official one? Indeed they don't, at least\n> on Arch Linux.\n\nYou're right.  They would certainly not, and the situation is quite\ndifferent from bash completion where we seem to be the authoritative\nimplementation.\n\nThis leads me in a totally different direction.\n\nWe are making life worse for the zsh users by shipping our own\nversion, aren't we?  If we didn't ship our own completion script for\nthem, the user did not have to remove the one \"which is considerably\nless complete/capable\".  Perhaps we are misleading users with our\nversion that has an implicit \"came from those who know Git the best\nin the world\" label that gives it more authenticity than it\ndeserves.  A good zsh autocompletion would need to be written and\nreviewed by those who know zsh completion well.  They also need to\nknow Git somewhat, but the expertise on the former would be a lot\nmore important, I would think.\n\nBut as you said in\n<CAMP44s3wqxTmgQpMgk2cM33EvtwrvvXYv4_90GKGmHb8yJHAKg@mail.gmail.com>\n\n    The answer is obvious: the set of zsh users and the set of git\n    developers don't overlap.\n\nthis community is not equipped to give good reviews and improvement\nsuggestions on zsh matters to your patches.  And I do not have a\nfeeling that the situation would change soon.\n\nDo your recent 29-patch improvements not just fill the \"gap\" but\nsurpass the one that comes by default with zsh?  I have this nagging\nfeeling that the effort to make the autocompletion better for Git\nusers who use zsh may be better made by you (\"git blame\" tells me that\nyou seem to be the only one who's invested heavily in the script,\nunfortunately) joining forces with those who develop and maintain the\nautocompletion that comes by default with zsh.  We may also want to\nhave a tombstone in contrib/completion/ to redirect the users to the\ndefault version and away from our \"less complete/capable\" one.\n\nThanks.\n"},{"id":"408720","messageId":"010c6222-4365-7446-a666-333ac7b4d415@haller-berlin.de","threadId":"51359","inReplyTo":"xmqqeelh7y23.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2020-10-30T08:01:28Z","receivedAt":"2020-10-30T08:11:08Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"On 29.10.20 18:16, Junio C Hamano wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n> \n>> On Wed, Oct 28, 2020 at 3:09 AM Stefan Haller <lists@haller-berlin.de> wrote:\n>>>\n>>> I might not be the representative zsh user, but just as one data point:\n>>> I have never downloaded the completion scripts from anywhere. I always\n>>> use the one that comes with my \"distro\" (which is the Mac git installer,\n>>> most of the time, which puts it in /usr/local/git/contrib/completion/).\n>>> I symlink that to ~/.zfunc/_git.\n> \n> That's one data point.\n> \n>>> I don't think it makes a difference whether the scripts live in contrib\n>>> or not. Bash completion is also in contrib, and yet it seems to be\n>>> shipped and enabled by most distros, as far as I can tell.\n>>\n>> Apples and oranges.\n>>\n>> There is no default completion for git in bash, neither in bash, nor\n>> in bash-completion, so if the distribution doesn't install the\n>> completion in the right place\n>> (/usr/share/bash-completion/completions/git), then the user would have\n>> no git completion.\n> \n> True, as far as I know.  https://github.com/scop/bash-completion does not\n> seem to have an entry for \"git\" (/usr/share/bash-completion/completions/git\n> however is locally there on my box---probably the corp IT folks installed\n> it there), so what we ship in contrib/ is the most used (if not the only)\n> implementation of bash completion script.\n> \n>> On zsh the situation is different; zsh by default has a git completion\n>> (/usr/share/zsh/functions/Completion/Unix/_git), and some might argue\n>> it's more complete than git's zsh completion,\n> \n> How is that completion script developed, maintained and distributed?\n> \n> By \"by default\" I believe you mean that it gets installed when you\n> install zsh automatically.  Is the situation different on macOS land\n> (which I can believe, unfortunately)?\n\nIt's the same on Mac; I get zsh's builtin git completion when I don't\ninstall ours.\n\n> Stefan?  If at least some people argue what comes with zsh by\n> default is more complete than the one we have in contrib/, what led\n> you choose to \"symlink\" the less complete one to use it instead?\n\nI'm not sure I can answer the question which one is more complete. Ours\nis certainly complete enough for my daily use, but this might not mean much.\n\nThe reason why I chose ours over the one that comes with zsh is that\nours is *way* faster. If I type \"git log origin/mas<tab>\", with zsh's\ncompletion it takes between one and two seconds to auto-complete this to\n\"origin/master\". With ours it's instantaneous.\n\n> Another question (this is for Felipe).  Is\n> \n>    https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/gitfast\n> \n> the one that comes with zsh by default, or is it something else\n> (perhaps it is the go-to version for those who are not satisfied\n> with the version that comes with zsh by default???)?\n> \n> Thanks.\n> \n"},{"id":"408762","messageId":"xmqqh7qb3a3r.fsf@gitster.c.googlers.com","threadId":"51359","inReplyTo":"010c6222-4365-7446-a666-333ac7b4d415@haller-berlin.de","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-30T17:19:20Z","receivedAt":"2020-10-30T17:20:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Haller <lists@haller-berlin.de> writes:\n\n>> How is that completion script developed, maintained and distributed?\n\nI think we should ask this question to those in Zsh development\ncommunity.\n\n>> By \"by default\" I believe you mean that it gets installed when you\n>> install zsh automatically.  Is the situation different on macOS land\n>> (which I can believe, unfortunately)?\n>\n> It's the same on Mac; I get zsh's builtin git completion when I don't\n> install ours.\n\nI see.  That makes sense.\n\n>> Stefan?  If at least some people argue what comes with zsh by\n>> default is more complete than the one we have in contrib/, what led\n>> you choose to \"symlink\" the less complete one to use it instead?\n>\n> I'm not sure I can answer the question which one is more complete. Ours\n> is certainly complete enough for my daily use, but this might not mean much.\n>\n> The reason why I chose ours over the one that comes with zsh is that\n> ours is *way* faster. If I type \"git log origin/mas<tab>\", with zsh's\n> completion it takes between one and two seconds to auto-complete this to\n> \"origin/master\". With ours it's instantaneous.\n\nThat is a very good data point.  I re-read the blurb on the\n\"gitfast\" thing (below) in ohmyzsh and learned that ...\n\n>> Another question (this is for Felipe).  Is\n>> \n>>    https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/gitfast\n>> \n>> the one that comes with zsh by default, or is it something else\n>> (perhaps it is the go-to version for those who are not satisfied\n>> with the version that comes with zsh by default???)?\n\n... it repackages what we have in contrib/ and promises a faster\ncompletion (which aligns with the reason you stated why you chose\nours) than the Zsh default one and being always fresh (by frequent\nupdates from our contrib/).  In other words, my understanding is\nthat it is positioned as a competitor to the Zsh default.\n\nAfter making a brief observation for my previous message in the\nthread, I understand that oh-my-zsh is a very popular colleciton of\nthird-party stuff for Zsh users, so it seems to me that the real\nuseful choices, if I or somebody else were to become a new Zsh user,\nare between sticking with the Zsh default or grabbing the improved\nversion from oh-my-zsh collection.  I could also use from our\ncontrib/ but I would have to ask myself twice why should I, as a\n(hypothetical) new Zsh user, bother, especially when the latter\npromises to be always fresh anyway.\n\nThanks.\n\n\n\n"},{"id":"408896","messageId":"CAMP44s1N+U79+sZ-smMrtePnE6_ottAB2uTQb-fdctc0ibZB_A@mail.gmail.com","threadId":"51359","inReplyTo":"xmqqeelh7y23.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-11-02T19:18:48Z","receivedAt":"2020-11-02T19:19:02Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Thu, Oct 29, 2020 at 11:16 AM Junio C Hamano <gitster@pobox.com> wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> > On zsh the situation is different; zsh by default has a git completion\n> > (/usr/share/zsh/functions/Completion/Unix/_git), and some might argue\n> > it's more complete than git's zsh completion,\n>\n> How is that completion script developed, maintained and distributed?\n\nBy the maintainers of Zsh.\n\n> By \"by default\" I believe you mean that it gets installed when you\n> install zsh automatically.  Is the situation different on macOS land\n> (which I can believe, unfortunately)?\n\nI don't believe it's different.\n\n> Another question (this is for Felipe).  Is\n>\n>   https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/gitfast\n>\n> the one that comes with zsh by default, or is it something else\n> (perhaps it is the go-to version for those who are not satisfied\n> with the version that comes with zsh by default???)?\n\nIt's for the people who are not satisfied with the default Zsh\nversion, which are a lot.\n\n-- \nFelipe Contreras\n"},{"id":"408902","messageId":"CAMP44s2bgZbKde-UFL7+sR-7QgEv5Oiho2LTi3RG7S4BD0iuaw@mail.gmail.com","threadId":"51359","inReplyTo":"xmqq361x7xj5.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-11-02T20:18:54Z","receivedAt":"2020-11-02T20:19:09Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Thu, Oct 29, 2020 at 11:27 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n> > Felipe Contreras <felipe.contreras@gmail.com> writes:\n> >\n> >> On zsh the situation is different; zsh by default has a git completion\n> >> (/usr/share/zsh/functions/Completion/Unix/_git), and some might argue\n> >> it's more complete than git's zsh completion,\n> >\n> > How is that completion script developed, maintained and distributed?\n> >\n> > By \"by default\" I believe you mean that it gets installed when you\n> > install zsh automatically.  Is the situation different on macOS land\n> > (which I can believe, unfortunately)?\n> > ...\n>\n> Web searching for \"zsh git autocompletion\" gave a few interesting insights.\n>\n>  - https://medium.com/@oliverspryn/adding-git-completion-to-zsh-60f3b0e7ffbc\n>    was the first hit, which is about how to use what we ship in contrib/\n\nIt's weird that he didn't have completion. He probably hadn't enabled\ncompletion (in general).\n\n>  - https://stackoverflow.com/questions/24513873/ which was near the top\n>    had these gems.\n\n> The \"knows out of the box\" in https://stackoverflow.com/a/58517668\n> is matches your \"zsh by default has\".\n\nThis is just the tip of the iceberg.\n\nIn the past people that wanted to have the Zsh default could do `brew\ninstall git --without-completions`, but the Homebrew team decided to\nremove that option, so now everyone gets the completions overridden by\ninstalling Git.\n\nhttps://github.com/Homebrew/homebrew-core/commit/f710a1395f44224e4bcc3518ee9c13a0dc850be1\n\n> > so why would\n> > distribution maintainers chose the one in 'contrib' (an unofficial\n> > contributed script) over the official one? Indeed they don't, at least\n> > on Arch Linux.\n>\n> You're right.  They would certainly not, and the situation is quite\n> different from bash completion where we seem to be the authoritative\n> implementation.\n>\n> This leads me in a totally different direction.\n>\n> We are making life worse for the zsh users by shipping our own\n> version, aren't we?  If we didn't ship our own completion script for\n> them, the user did not have to remove the one \"which is considerably\n> less complete/capable\".\n\nNo. You are assuming the opinion of one user in Stack Overflow is a fact.\n\nThere's a reason people prefer to use Git's official completion, and\nthere's a reason I wrote the wrapper.\n\nThe Zsh default completion is *incredibly* slow. Just as a point of\ncomparison when I do `git checkout <tab>` on the Linux kernel git\nrepository, it takes *three* seconds to complete. With the Git\nofficial completion it's instantaneous, just like in Bash.\n\nThis defeats the whole purpose of completion. If it takes less time\nfor me to type the thing than it takes the completion to complete it,\nthen the completion is useless. I explained this to the Zsh\ndevelopers[1], and they didn't care.\n\nThey prioritize completeness over usability.\n\nI even wrote a blog post about the issue:\n\nhttps://felipec.wordpress.com/2013/07/31/how-i-fixed-git-zsh-completion/\n\n> Perhaps we are misleading users with our\n> version that has an implicit \"came from those who know Git the best\n> in the world\" label that gives it more authenticity than it\n> deserves.\n\nAnd perhaps not.\n\n> A good zsh autocompletion would need to be written and\n> reviewed by those who know zsh completion well.\n\nNo. Those people don't care if their completion is unusable.\n\nZsh users want a completion that is usable, and achieves the purpose\nof a completion; to make the user more productive. Not a completion\nZsh developers feel proud about.\n\n> They also need to\n> know Git somewhat, but the expertise on the former would be a lot\n> more important, I would think.\n\nI disagree. To make the Git completion fast, efficient, and consistent\nto how Git is supposed to be used, it's much more important to know\nGit.\n\nFor example, if you do `git <tab>` in Git's Zsh completion, you get\nonly porcelain commands, if you do the same in Zsh's default\ncompletion, you get \"check-attr\" in the list, which I doubt any Git\ndeveloper would consider something the user should see by default.\n\nYou can do `git check-<tab>` and the Git's Zsh completion I wrote will\nstill complete it, even though it's not visible initially.\n\nSo in that sense *my* code is superior; 1) It shows only the common\ncommands by default, 2) all commands can be completed anyway, and 3)\ncan be configured to show aliases too, and the order can be configured\ntoo.\n\nWhy didn't the Zsh default completion do this? I don't know.\n\n> But as you said in\n> <CAMP44s3wqxTmgQpMgk2cM33EvtwrvvXYv4_90GKGmHb8yJHAKg@mail.gmail.com>\n>\n>     The answer is obvious: the set of zsh users and the set of git\n>     developers don't overlap.\n>\n> this community is not equipped to give good reviews and improvement\n> suggestions on zsh matters to your patches.  And I do not have a\n> feeling that the situation would change soon.\n\nNeither does any other community.\n\nBut in this community at least some people try.\n\n> Do your recent 29-patch improvements not just fill the \"gap\" but\n> surpass the one that comes by default with zsh?  I have this nagging\n> feeling that the effort to make the autocompletion better for Git\n> users who use zsh may be better made by you (\"git blame\" tells me that\n> you seem to be the only one who's invested heavily in the script,\n> unfortunately) joining forces with those who develop and maintain the\n> autocompletion that comes by default with zsh.\n\nThis is not possible, as the Zsh maintainers don't care about usability.\n\nPlus, the whole point of my wrapper is to leverage the Bash\ncompletion, which is actively maintained. The Zsh developers would\n*never* agree to use the Bash completion in any capacity.\n\nThe current situation is far from ideal, but I don't see any obvious\nway to improve it.\n\n[1] https://www.zsh.org/mla/workers/2011/msg00506.html\n\n-- \nFelipe Contreras\n"},{"id":"408903","messageId":"CAMP44s3Tx1DdzD3fAOA+_3fLMK6Ew9GQAJWiRoA2KR156jiZBg@mail.gmail.com","threadId":"51359","inReplyTo":"xmqqh7qb3a3r.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-11-02T20:29:21Z","receivedAt":"2020-11-02T20:29:36Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Fri, Oct 30, 2020 at 11:19 AM Junio C Hamano <gitster@pobox.com> wrote:\n\n> After making a brief observation for my previous message in the\n> thread, I understand that oh-my-zsh is a very popular colleciton of\n> third-party stuff for Zsh users, so it seems to me that the real\n> useful choices, if I or somebody else were to become a new Zsh user,\n> are between sticking with the Zsh default or grabbing the improved\n> version from oh-my-zsh collection.  I could also use from our\n> contrib/ but I would have to ask myself twice why should I, as a\n> (hypothetical) new Zsh user, bother, especially when the latter\n> promises to be always fresh anyway.\n\nMore or less. Oh-My-Zsh is very popular, but not everyone uses it, and\nit's certainly not cheap on resources (it makes the startup a bit\nslower).\n\nSo the two options are:\n\n1. Use the script in contrib/ (or git-completion)\n2. Use Oh-My-Zsh and enable the \"gitfast\" plugin\n\nIn my opinion to use the Zsh default completion is not an option.\n\nWhich is why I think distributions should package the Git Zsh\ncompletion by default (like Hombrew does), which will happen more\neasily if Git graduated those scripts and installed them by default.\n\nIf this close-to-ideal solution was considered, I would investigate\nagain if there's a way to automate the testing of the Zsh wrapper, so\nthat it doesn't break when the Bash script is updated (which is the\nusual way the Zsh wrapper breaks).\n\nCheers.\n\n-- \nFelipe Contreras\n"},{"id":"408951","messageId":"X6CQpfuhRkAwmMou@pug.qqx.org","threadId":"51359","inReplyTo":"CAMP44s3Tx1DdzD3fAOA+_3fLMK6Ew9GQAJWiRoA2KR156jiZBg@mail.gmail.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Aaron Schrab","fromEmail":"aaron@schrab.com","sentAt":"2020-11-02T23:05:09Z","receivedAt":"2020-11-02T23:14:08Z","isPatch":true,"sender":{"key":"aaron@schrab.com","avatar":"https://avatars.githubusercontent.com/u/39620?v=4"},"body":"At 14:29 -0600 02 Nov 2020, Felipe Contreras <felipe.contreras@gmail.com> wrote:\n>So the two options are:\n>\n>1. Use the script in contrib/ (or git-completion)\n>2. Use Oh-My-Zsh and enable the \"gitfast\" plugin\n>\n>In my opinion to use the Zsh default completion is not an option.\n>\n>Which is why I think distributions should package the Git Zsh\n>completion by default (like Hombrew does), which will happen more\n>easily if Git graduated those scripts and installed them by default.\n\nThe option that you consider to be invalid is definitely *my* preferred \noption. That Homebrew's git package installs the completion in a way \nthat overrides that from the zsh package was a source of continual \nannoyance for me until I put in a long-term workaround for that (I had \njust been removing the symlink every time I noticed that it had been \ncreated by a new install of the git package).\n\nWhile the completion provided by git.git may be faster, the one from zsh \nis fast enough on the repositories that I generally work with.  At least \nwith my configuration and the completion code currently shipped by \nHomobrew's git package there are at least a couple of things that seem \nto be quite broken.\n\nThe one that generally caused me to notice that the wrong completion \ncode was being used is that it doesn't provide completion for creating \nlocal branches to based off of remote ones; I'd previously thought that \nwas just a missing feature, but looking into it a bit more now it looks \nlike that **should** happen as long as I don't set \nGIT_COMPLETION_CHECKOUT_NO_GUESS=1.\n\nThe other thing that seems to not work with the completion from git.git \nis completion of single-dash options. Although that may be more of a \nmissing feature rather than something that's broken. Since there isn't \nany description for long options, I'd guess there wouldn't be for short \noptions either; in which case there isn't really any point to trying to \noffer completion for those. But, having additional descriptions for \noptions is one of my favorite features of zsh completion.\n"},{"id":"408976","messageId":"xmqqwnz3nrwx.fsf@gitster.c.googlers.com","threadId":"51359","inReplyTo":"X6CQpfuhRkAwmMou@pug.qqx.org","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-11-03T01:35:42Z","receivedAt":"2020-11-03T01:35:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Aaron Schrab <aaron@schrab.com> writes:\n\n> At 14:29 -0600 02 Nov 2020, Felipe Contreras <felipe.contreras@gmail.com> wrote:\n>>So the two options are:\n>>\n>>1. Use the script in contrib/ (or git-completion)\n>>2. Use Oh-My-Zsh and enable the \"gitfast\" plugin\n>>\n>>In my opinion to use the Zsh default completion is not an option.\n>>\n>>Which is why I think distributions should package the Git Zsh\n>>completion by default (like Hombrew does), which will happen more\n>>easily if Git graduated those scripts and installed them by default.\n>\n> The option that you consider to be invalid is definitely *my*\n> preferred option. That Homebrew's git package installs the completion\n> in a way that overrides that from the zsh package was a source of\n> continual annoyance for me until I put in a long-term workaround for\n> that (I had just been removing the symlink every time I noticed that\n> it had been created by a new install of the git package).\n\nThanks for a data point.  \n\nMy understanding is that Felipe's 1 & 2 are essentially the same\nthing in the larger picture but they come in different packaging.\n\nIf we talk about two choices, I think they are between the Zsh\ndefault or gitfast from oh-my-zsh.\n\nAnd your preference is the former.  It is not like I picked a wrong\nSO thread and was swayed by an oddball opinion of somebody who\nprefers the Zsh default.  Even though the preference is up to\nindividual users, the important point here is that Zsh default is\nnot universally unusable for everybody and it is one of the valid\nchoices.\n"},{"id":"408977","messageId":"xmqq7dr3nr9h.fsf@gitster.c.googlers.com","threadId":"51359","inReplyTo":"CAMP44s2bgZbKde-UFL7+sR-7QgEv5Oiho2LTi3RG7S4BD0iuaw@mail.gmail.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-11-03T01:49:46Z","receivedAt":"2020-11-03T01:49: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>> We are making life worse for the zsh users by shipping our own\n>> version, aren't we?  If we didn't ship our own completion script for\n>> them, the user did not have to remove the one \"which is considerably\n>> less complete/capable\".\n>\n> No. You are assuming the opinion of one user in Stack Overflow is a fact.\n>\n> There's a reason people prefer to use Git's official completion, and\n> there's a reason I wrote the wrapper.\n\nDo you mean by \"the wrapper\" the 'gitfast' one you offer in the\noh-my-zsh collection?  If so, yes, I agree that 'gitfast' as \"maybe\nless complete but usably faster auto-completer\" is a good thing for\nend-users to have as an alternative to the Zsh default.\n\nBut that was not the point I was raising.  I was saying that it was\nnot making life better for them that we are posing as a valid third\nchoice in that competition.\n\nYour \"wrapper\" can still be updated regularly to the latest to grab\nthe bash completion part from \"git.git\".  To the Zsh audience,\nhowever, it would be more straight-forward if the choices were\n\"there is Zsh default completion, but if you want to use a\ndifferent/better version, grab 'gitfast' from the oh-my-zsh\ncollection\" than \"you can use Zsh default, or you can install\n'gitfast' in the way Zsh users are accustomed to from the oh-my-zsh\ncollection, or you can manually install from git.git\".  After all,\nthe latter two would give them the same thing.\n\nIt may be a good idea to leave a message in contrib/completion that\nnudges people toward 'gitfast' as an alternative for thowe who want\nto use something other than the default Zsh autocompletion.\n\nDoing so would remove one level of unnecessary middleman (that is\nus) from the picture and make it simpler for end-users by reducing\nthe number of choices from three to two.\n\n> They prioritize completeness over usability.\n> ...\n> No. Those people don't care if their completion is unusable.\n> ...\n> This is not possible, as the Zsh maintainers don't care about usability.\n\nI think our code of conduct applies to derogatory statements made on\neven those who do not regularly appear in this community.  If you\nwant to attack them, please don't do it here.  Thanks.\n"},{"id":"408985","messageId":"e2b59b69-7fd2-f52c-eb06-6b97e3de557a@haller-berlin.de","threadId":"51359","inReplyTo":"xmqqh7qb3a3r.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2020-11-03T09:59:14Z","receivedAt":"2020-11-03T09:59:22Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"On 30.10.20 18:19, Junio C Hamano wrote:\n> Stefan Haller <lists@haller-berlin.de> writes:\n> \n>>> How is that completion script developed, maintained and distributed?\n> \n> I think we should ask this question to those in Zsh development\n> community.\n> \n>>> By \"by default\" I believe you mean that it gets installed when you\n>>> install zsh automatically.  Is the situation different on macOS land\n>>> (which I can believe, unfortunately)?\n>>\n>> It's the same on Mac; I get zsh's builtin git completion when I don't\n>> install ours.\n> \n> I see.  That makes sense.\n> \n>>> Stefan?  If at least some people argue what comes with zsh by\n>>> default is more complete than the one we have in contrib/, what led\n>>> you choose to \"symlink\" the less complete one to use it instead?\n>>\n>> I'm not sure I can answer the question which one is more complete. Ours\n>> is certainly complete enough for my daily use, but this might not mean much.\n>>\n>> The reason why I chose ours over the one that comes with zsh is that\n>> ours is *way* faster. If I type \"git log origin/mas<tab>\", with zsh's\n>> completion it takes between one and two seconds to auto-complete this to\n>> \"origin/master\". With ours it's instantaneous.\n> \n> That is a very good data point.  I re-read the blurb on the\n> \"gitfast\" thing (below) in ohmyzsh and learned that ...\n> \n>>> Another question (this is for Felipe).  Is\n>>>\n>>>    https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/gitfast\n>>>\n>>> the one that comes with zsh by default, or is it something else\n>>> (perhaps it is the go-to version for those who are not satisfied\n>>> with the version that comes with zsh by default???)?\n> \n> ... it repackages what we have in contrib/ and promises a faster\n> completion (which aligns with the reason you stated why you chose\n> ours) than the Zsh default one and being always fresh (by frequent\n> updates from our contrib/).  In other words, my understanding is\n> that it is positioned as a competitor to the Zsh default.\n> \n> After making a brief observation for my previous message in the\n> thread, I understand that oh-my-zsh is a very popular colleciton of\n> third-party stuff for Zsh users, so it seems to me that the real\n> useful choices, if I or somebody else were to become a new Zsh user,\n> are between sticking with the Zsh default or grabbing the improved\n> version from oh-my-zsh collection.  I could also use from our\n> contrib/ but I would have to ask myself twice why should I, as a\n> (hypothetical) new Zsh user, bother, especially when the latter\n> promises to be always fresh anyway.\n\nUsing stuff from oh-my-zsh is not an option for me. I'm not using\noh-my-zsh, and I don't want to begin using it just for this one package.\n\nI could use Felipe's version from\n<https://github.com/felipec/git-completion> (and in fact, that's what\nI'm doing right now, for testing. Works great. :-)  However, I'd have to\nremember to manually update it every so often.\n\nSo yes, I prefer to use the one from git's distribution, because it is\nautomatically kept up to date whenever I update git (as long as I\nsymlink to it rather than copy it.)\n\n-Stefan\n"},{"id":"409020","messageId":"xmqqlffis6u0.fsf@gitster.c.googlers.com","threadId":"51359","inReplyTo":"e2b59b69-7fd2-f52c-eb06-6b97e3de557a@haller-berlin.de","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-11-03T17:12:07Z","receivedAt":"2020-11-03T17:12:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Haller <lists@haller-berlin.de> writes:\n\n> Using stuff from oh-my-zsh is not an option for me. I'm not using\n> oh-my-zsh, and I don't want to begin using it just for this one package.\n>\n> I could use Felipe's version from\n> <https://github.com/felipec/git-completion> (and in fact, that's what\n> I'm doing right now, for testing. Works great. :-)  However, I'd have to\n> remember to manually update it every so often.\n>\n> So yes, I prefer to use the one from git's distribution, because it is\n> automatically kept up to date whenever I update git (as long as I\n> symlink to it rather than copy it.)\n\nThanks for another data point.  \n\nYou'd need to add to another \"as long as\", which is \"as long as it\nkeeps up with felipec/git-completion\".  If we fall bahind, you'd be\nbetter off getting updates directly from there, not from us.  \n\nAnd I suspect that not many Zsh users want to care about the\ndistinction between the two.  If it were as easy to grab the latest\nversion of Felipe's as an update of Git from your distro, wouldn't\nmost people rather choose to do so?\n\nIf we are not doing much reviews on Zsh completion on this list, due\nto lack of interest and expertise, then we will either fall behind,\nor blindly copy, Felipe's repository and republish as a small part\nof our project, without adding much value ourselves.\n\nWhich is not a very happy place for us to be in.  I dunno.\n"},{"id":"409037","messageId":"1815f1ab-b293-e948-9624-76fc83d66d99@haller-berlin.de","threadId":"51359","inReplyTo":"xmqqlffis6u0.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Stefan Haller","fromEmail":"stefan@haller-berlin.de","sentAt":"2020-11-03T20:07:04Z","receivedAt":"2020-11-03T20:07:11Z","isPatch":true,"sender":{"key":"stefan@haller-berlin.de","avatar":"https://avatars.githubusercontent.com/u/1225667?v=4"},"body":"On 03.11.20 18:12, Junio C Hamano wrote:\n> Stefan Haller <lists@haller-berlin.de> writes:\n> \n>> Using stuff from oh-my-zsh is not an option for me. I'm not using\n>> oh-my-zsh, and I don't want to begin using it just for this one package.\n>>\n>> I could use Felipe's version from\n>> <https://github.com/felipec/git-completion> (and in fact, that's what\n>> I'm doing right now, for testing. Works great. :-)  However, I'd have to\n>> remember to manually update it every so often.\n>>\n>> So yes, I prefer to use the one from git's distribution, because it is\n>> automatically kept up to date whenever I update git (as long as I\n>> symlink to it rather than copy it.)\n> \n> Thanks for another data point.  \n> \n> You'd need to add to another \"as long as\", which is \"as long as it\n> keeps up with felipec/git-completion\".  If we fall bahind, you'd be\n> better off getting updates directly from there, not from us.  \n\nYes, that's true of course. That's why I'm happy that Felipe contributes\nhis version here, and that you are accepting it quickly.\n\n> And I suspect that not many Zsh users want to care about the\n> distinction between the two.  If it were as easy to grab the latest\n> version of Felipe's as an update of Git from your distro, wouldn't\n> most people rather choose to do so?\n> \n> If we are not doing much reviews on Zsh completion on this list, due\n> to lack of interest and expertise, then we will either fall behind,\n> or blindly copy, Felipe's repository and republish as a small part\n> of our project, without adding much value ourselves.\n> \n> Which is not a very happy place for us to be in.  I dunno.\n\nI still think it's valuable to do this. And I think the fact that it's\nin contrib makes it less likely that we fall behind, because you can\njust choose to merge updates without very thorough reviews (like with\nthe current patch series), which you probably wouldn't feel comfortable\ndoing if it had \"graduated\" out of contrib, as Felipe requests.\n\n-Stefan\n"},{"id":"409054","messageId":"CAMP44s3w1uBgupT-K0FbR7Zjtp6+z0PfdbkGvnFX0SpA9qF1FQ@mail.gmail.com","threadId":"51359","inReplyTo":"X6CQpfuhRkAwmMou@pug.qqx.org","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-11-03T22:37:14Z","receivedAt":"2020-11-03T22:37:30Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Mon, Nov 2, 2020 at 5:05 PM Aaron Schrab <aaron@schrab.com> wrote:\n\n> The option that you consider to be invalid is definitely *my* preferred\n> option. That Homebrew's git package installs the completion in a way\n> that overrides that from the zsh package was a source of continual\n> annoyance for me until I put in a long-term workaround for that (I had\n> just been removing the symlink every time I noticed that it had been\n> created by a new install of the git package).\n\nYou are probably a minority.\n\nJust put the location of your desired completion in front of your fpath\n\n  fpath=(/usr/share/zsh/functions/Completion/Unix $fpath)\n\n> While the completion provided by git.git may be faster, the one from zsh\n> is fast enough on the repositories that I generally work with.\n\nThere's no such thing as \"fast enough\" for most Git developers.\n\n> At least\n> with my configuration and the completion code currently shipped by\n> Homobrew's git package there are at least a couple of things that seem\n> to be quite broken.\n\nIf they are still broken in this version:\nhttps://github.com/felipec/git-completion\n\nFeel free to open an issue report.\n\n> The one that generally caused me to notice that the wrong completion\n> code was being used is that it doesn't provide completion for creating\n> local branches to based off of remote ones; I'd previously thought that\n> was just a missing feature, but looking into it a bit more now it looks\n> like that **should** happen as long as I don't set\n> GIT_COMPLETION_CHECKOUT_NO_GUESS=1.\n\nThat was a bug because somebody added a new function to the Bash\nscript and forgot to add it to the Zsh script.\n\nI've sent the fix:\n\nhttps://lore.kernel.org/git/20201028020712.442623-14-felipe.contreras@gmail.com/\n\n> The other thing that seems to not work with the completion from git.git\n> is completion of single-dash options. Although that may be more of a\n> missing feature rather than something that's broken. Since there isn't\n> any description for long options, I'd guess there wouldn't be for short\n> options either; in which case there isn't really any point to trying to\n> offer completion for those. But, having additional descriptions for\n> options is one of my favorite features of zsh completion.\n\nThat's a feature request.\n\nIt may work at some point, but it would require a lot of work. In the\nmeantime you can simply use the default Zsh completion.\n\nThe point of the Zsh completion is to offer everything the Bash\ncompletion offers. Which is clearly fine for most people, since that's\nthe completion most people use.\n\nCheers.\n\n-- \nFelipe Contreras\n"},{"id":"409055","messageId":"CAMP44s3yfdKA3y8NihDwRGh-RzAohWncnztJo9aU-F-GO=UY8g@mail.gmail.com","threadId":"51359","inReplyTo":"xmqqwnz3nrwx.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-11-03T23:46:05Z","receivedAt":"2020-11-03T23:46:20Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Mon, Nov 2, 2020 at 7:35 PM Junio C Hamano <gitster@pobox.com> wrote:\n\n> My understanding is that Felipe's 1 & 2 are essentially the same\n> thing in the larger picture but they come in different packaging.\n\nYes, and no. That's like saying you get the same thing with Gentoo\nthan with Ubuntu.\n\nYes; you get the same thing, but no; Oh-My-Zsh comes with a lot more\nyou might not necessarily want.\n\n> And your preference is the former.  It is not like I picked a wrong\n> SO thread and was swayed by an oddball opinion of somebody who\n> prefers the Zsh default.  Even though the preference is up to\n> individual users, the important point here is that Zsh default is\n> not universally unusable for everybody and it is one of the valid\n> choices.\n\nI think that's debatable. If I had to be it would be on a 50/50 split.\nBut that's considering that most people never change their default.\n\nIf my script were the default, my bet would be on a 90/10 split (at\nleast). Yes, there are some people who do prefer the Zsh default but\nnot many.\n\nSeriously, submit yourself to one hour of the default Zsh completion,\nI bet you will consider it torture.\n\n-- \nFelipe Contreras\n"},{"id":"409056","messageId":"CAMP44s1RS2-8rOvZLidRjkB=dkBGRpPzhpwpQByDRObP7UMLFw@mail.gmail.com","threadId":"51359","inReplyTo":"xmqq7dr3nr9h.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-11-04T00:09:58Z","receivedAt":"2020-11-04T00:10:14Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Mon, Nov 2, 2020 at 7:49 PM Junio C Hamano <gitster@pobox.com> wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> > There's a reason people prefer to use Git's official completion, and\n> > there's a reason I wrote the wrapper.\n>\n> Do you mean by \"the wrapper\" the 'gitfast' one you offer in the\n> oh-my-zsh collection?  If so, yes, I agree that 'gitfast' as \"maybe\n> less complete but usably faster auto-completer\" is a good thing for\n> end-users to have as an alternative to the Zsh default.\n\nNo, I mean the Git Zsh wrapper that I wrote.\n\nIt's in three locations right now:\n\n1. https://git.kernel.org/pub/scm/git/git.git/tree/contrib/completion/git-completion.zsh\n2. https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/gitfast/_git\n3. https://github.com/felipec/git-completion/blob/master/git-completion.zsh\n\nAll these are the same thing.\n\nIf git was installing this wrapper by default, there would be no need\nfor the gitfast plugin, nor the git-completion project.\n\n> But that was not the point I was raising.  I was saying that it was\n> not making life better for them that we are posing as a valid third\n> choice in that competition.\n>\n> Your \"wrapper\" can still be updated regularly to the latest to grab\n> the bash completion part from \"git.git\".  To the Zsh audience,\n> however, it would be more straight-forward if the choices were\n> \"there is Zsh default completion, but if you want to use a\n> different/better version, grab 'gitfast' from the oh-my-zsh\n> collection\" than \"you can use Zsh default, or you can install\n> 'gitfast' in the way Zsh users are accustomed to from the oh-my-zsh\n> collection, or you can manually install from git.git\".  After all,\n> the latter two would give them the same thing.\n\nThe default is by definition not a choice. You make a choice to move\naway from the default.\n\nAnd the gitfast plugin is not different from what was in contrib, in\nfact I wrote a script to update it directly from there [1] (I changed\nit recently to fetch from the git-completion project).\n\n> It may be a good idea to leave a message in contrib/completion that\n> nudges people toward 'gitfast' as an alternative for thowe who want\n> to use something other than the default Zsh autocompletion.\n\nIf we are going to leave a message it would have to be for\ngit-completion, since not all zsh users use Oh-MyZsh (maybe most\ndon't), and gitfast is nothing but a copy of git-completion.\n\n> Doing so would remove one level of unnecessary middleman (that is\n> us) from the picture and make it simpler for end-users by reducing\n> the number of choices from three to two.\n\nThis would break the experience of Homebrew users, and possibly Linux\ndistributions that do package this wrapper by default.\n\nBut if you are not going to consider graduating the scripts, we might\nas well break the experience for everyone, so everyone is at the same\nlevel.\n\n> > They prioritize completeness over usability.\n> > ...\n> > No. Those people don't care if their completion is unusable.\n> > ...\n> > This is not possible, as the Zsh maintainers don't care about usability.\n>\n> I think our code of conduct applies to derogatory statements made on\n> even those who do not regularly appear in this community.\n\nTo state the opinion of a person is not a derogatory statement. This\nis literally what they said:\n\n> > > Now, how about you make a compromise between \"correctness\" and\n> > > usability?\n> >\n> > No.\n\nI'm not doing anything but repeating their stated opinion. It is a\nfact. If you don't like their stated opinion, feel free to talk to\nthem.\n\nCheers.\n\n[1] https://github.com/ohmyzsh/ohmyzsh/blob/d69bad8eb4157e5fd5c1a4ce98f93cf522477a8c/plugins/gitfast/update\n\n-- \nFelipe Contreras\n"},{"id":"409119","messageId":"xmqqsg9pm1v4.fsf@gitster.c.googlers.com","threadId":"51359","inReplyTo":"CAMP44s1RS2-8rOvZLidRjkB=dkBGRpPzhpwpQByDRObP7UMLFw@mail.gmail.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-11-04T18:08:15Z","receivedAt":"2020-11-04T18:08:29Z","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> To state the opinion of a person is not a derogatory statement. This\n> is literally what they said:\n>\n>> > > Now, how about you make a compromise between \"correctness\" and\n>> > > usability?\n>> >\n>> > No.\n>\n> I'm not doing anything but repeating their stated opinion. It is a\n> fact. If you don't like their stated opinion, feel free to talk to\n> them.\n\nI had to read the exchange three times to be reasonably confident\nthat the party that was asking the question was you and Zsh folks\nwas who said \"No.\", as there were so little in the context to go by,\nin order to tell what was being discussed (I initially even thought\nthey asked the question and you gave a short \"no\", before realizing\nit probably is the other way around).\n\nIn the short quote given without enough context, I cannot see\nanything more than a disagreement of the degree of \"correctness\" and\n\"usability\" expected by the two parties in the discussion.\n\nEven if I knew what exact \"incorrectness\" and \"usability\" were on\ntopic back when you two argued, I know people strike balance at\ndifferent place.  Even though I may agree with your argument in that\nparticular case, I can understand (if not accept) if Zsh folks\nthought differently.  And it does not matter if I agree with you\nthat they are better off taking a small \"incorrectness\" to gain\n\"usability\"---the Zsh show is run over there by Zsh folks, and I am\nnot a participant.\n\nBut the take-away I got from your short quote was that I see no\nevidence that Zsh folks do not care about usability.\n"},{"id":"409193","messageId":"CAMP44s3occuUi2no8JfxPreLouvMsKKBcivKbv8XMTToZowz5w@mail.gmail.com","threadId":"51359","inReplyTo":"xmqqsg9pm1v4.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-11-05T01:09:13Z","receivedAt":"2020-11-05T01:09:29Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, Nov 4, 2020 at 12:08 PM Junio C Hamano <gitster@pobox.com> wrote:\n\n> But the take-away I got from your short quote was that I see no\n> evidence that Zsh folks do not care about usability.\n\nThis exchange happened 9 years ago, so I wouldn't place too much of a\nburden on what they actually meant by what they said.\n\nEven if my interpretation of what they said at that point of time is\n100% incorrect; it's not a *derogatory* statement; it would simply be\nan unfactual statement.\n\nI will contact them again with some fixes to their code, but not just yet.\n\nCheers.\n\n-- \nFelipe Contreras\n"},{"id":"409238","messageId":"xmqqmtzvh2wu.fsf@gitster.c.googlers.com","threadId":"51359","inReplyTo":"CAMP44s3occuUi2no8JfxPreLouvMsKKBcivKbv8XMTToZowz5w@mail.gmail.com","subject":"Re: [PATCH 00/14] completion: a bunch of updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-11-05T22:09:05Z","receivedAt":"2020-11-05T22:09:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> On Wed, Nov 4, 2020 at 12:08 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n>> But the take-away I got from your short quote was that I see no\n>> evidence that Zsh folks do not care about usability.\n>\n> This exchange happened 9 years ago, so I wouldn't place too much of a\n> burden on what they actually meant by what they said.\n\nIn other words, you are now saying that it does not demonstrate your\nearlier claim that they do not care about usability at all?\n\n> Even if my interpretation of what they said at that point of time is\n> 100% incorrect; it's not a *derogatory* statement; it would simply be\n> an unfactual statement.\n\nSo, the short quote given without much context was an attempt to\nmislead those who are reading this discussion?  That sounds even\nworse to me.\n\nIn any case, so far you managed to convince me even less that it\nwould help the Zsh userbase to carry a \"by default has to fall\nbehind\" copy of what they can get, or their distro packagers can\npackage, the latest and greatest directly from your github\nrepository as part of the release of this project.\n\nThanks, and bye for now.\n"}]}