{"thread":{"id":"55822","subject":"[PATCH v4] contrib/completion: fix zsh completion regression from 59d85a2a05","startedAt":"2021-06-01T20:52:34Z","lastAt":"2021-06-02T07:13:36Z","messageCount":3,"participants":["David Aguilar","Felipe Contreras","Denton Liu"],"isPatch":true,"patchVersion":4,"patchTotal":null},"messages":[{"id":"426160","messageId":"20210601205229.46974-1-davvid@gmail.com","threadId":"55822","inReplyTo":null,"subject":"[PATCH v4] contrib/completion: fix zsh completion regression from 59d85a2a05","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2021-06-01T20:52:29Z","receivedAt":"2021-06-01T20:52:34Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"A recent change to make git-completion.bash use $__git_cmd_idx\nin more places broke a number of completions on zsh because it\nmodified __git_main but did not update __git_zsh_main.\n\nNotably, completions for \"add\", \"branch\", \"mv\" and \"push\" were\nbroken as a result of this change.\n\nIn addition to the undefined variable usage, \"git mv <tab>\" also\nprints the following error:\n\n\t__git_count_arguments:7: bad math expression:\n\toperand expected at `\"1\"'\n\n\t_git_mv:[:7: unknown condition: -gt\n\nRemove the quotes around $__git_cmd_idx in __git_count_arguments\nand set __git_cmd_idx=1 early in __git_zsh_main to fix the\nregressions from 59d85a2a05.\n\nThis was tested on zsh 5.7.1 (x86_64-apple-darwin19.0).\n\nSuggested-by: Felipe Contreras <felipe.contreras@gmail.com>\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nChanges since v3:\n\n- Dropped the addition of \"git\" in the words array.\n- This is effectively the as the v2 patch after Felipe's suggestsions.\n- The difference between this patch and v2 is the Suggested-by trailer.\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 3c5739b905..b50c5d0ea3 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1306,7 +1306,7 @@ __git_count_arguments ()\n \tlocal word i c=0\n \n \t# Skip \"git\" (first argument)\n-\tfor ((i=\"$__git_cmd_idx\"; i < ${#words[@]}; i++)); do\n+\tfor ((i=$__git_cmd_idx; i < ${#words[@]}; i++)); do\n \t\tword=\"${words[i]}\"\n \n \t\tcase \"$word\" in\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 6c56296997..cac6f61881 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -251,7 +251,7 @@ __git_zsh_main ()\n \t\tdone\n \t\t;;\n \t(arg)\n-\t\tlocal command=\"${words[1]}\" __git_dir\n+\t\tlocal command=\"${words[1]}\" __git_dir __git_cmd_idx=1\n \n \t\tif (( $+opt_args[--bare] )); then\n \t\t\t__git_dir='.'\n-- \n2.32.0.rc2.1.gf67de2b3ac\n\n"},{"id":"426177","messageId":"60b6c57c3cac1_4044208f@natae.notmuch","threadId":"55822","inReplyTo":"20210601205229.46974-1-davvid@gmail.com","subject":"RE: [PATCH v4] contrib/completion: fix zsh completion regression from 59d85a2a05","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2021-06-01T23:40:44Z","receivedAt":"2021-06-01T23:40:48Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"David Aguilar wrote:\n> A recent change to make git-completion.bash use $__git_cmd_idx\n> in more places broke a number of completions on zsh because it\n> modified __git_main but did not update __git_zsh_main.\n\nYou might want to try this in the future to reference previous commits:\n\n  % git show --quiet --format=reference\n  59d85a2a05 (git-completion.bash: use $__git_cmd_idx in more places, 2021-04-22)\n\n(one of the aliases I'm missing right now)\n  \n> Suggested-by: Felipe Contreras <felipe.contreras@gmail.com>\n> Signed-off-by: David Aguilar <davvid@gmail.com>\n\nI have not tested this particular version, but I have tested similar\nchanges, and this should work:\n\nAcked-by: Felipe Contreras <felipe.contreras@gmail.com>\n\n-- \nFelipe Contreras\n"},{"id":"426204","messageId":"YLcvmrwT/ZuMts2C@generichostname","threadId":"55822","inReplyTo":"60b6c57c3cac1_4044208f@natae.notmuch","subject":"Re: [PATCH v4] contrib/completion: fix zsh completion regression from 59d85a2a05","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2021-06-02T07:13:30Z","receivedAt":"2021-06-02T07:13:36Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"On Tue, Jun 01, 2021 at 06:40:44PM -0500, Felipe Contreras wrote:\n> I have not tested this particular version, but I have tested similar\n> changes, and this should work:\n> \n> Acked-by: Felipe Contreras <felipe.contreras@gmail.com>\n\nFWIW, since I was the one who introduced the bug,\n\nAcked-by: Denton Liu <liu.denton@gmail.com>\n\nThanks for your help, David and Felipe.\n"}]}