{"thread":{"id":"60214","subject":"[PATCH] completion: improve doc for complex aliases","startedAt":"2023-09-09T16:25:38Z","lastAt":"2023-09-22T19:49:10Z","messageCount":12,"participants":["Philippe Blain via GitGitGadget","Eric Sunshine","Linus Arver","Philippe Blain","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"481627","messageId":"pull.1585.git.1694274592854.gitgitgadget@gmail.com","threadId":"60214","inReplyTo":null,"subject":"[PATCH] completion: improve doc for complex aliases","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-09-09T15:49:52Z","receivedAt":"2023-09-09T16:25:38Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nThe completion code can be told to use a particular completion for\naliases that shell out by using ': git <cmd> ;' as the first command of\nthe alias. This only works if <cmd> and the semicolon are separated by a\nspace. The examples have that space but it's not clear if it's just for\nstyle or if it's mandatory.\n\nExplicitely mention it.\n\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n    completion: improve doc for complex aliases\n    \n    The completion code can be told to use a particular completion for\n    aliases that shell out by using ': git ;' as the first command of the\n    alias. This only works if and the semicolon are separated by a space.\n    The examples have that space but it's not clear if it's just for style\n    or if it's mandatory.\n    \n    Explicitely mention it.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1585%2Fphil-blain%2Fcompletion-shell-aliases-doc-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1585/phil-blain/completion-shell-aliases-doc-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1585\n\n contrib/completion/git-completion.bash | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex dc95c34cc85..659df570496 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -28,6 +28,7 @@\n # completion style.  For example '!f() { : git commit ; ... }; f' will\n # tell the completion to use commit completion.  This also works with aliases\n # of form \"!sh -c '...'\".  For example, \"!sh -c ': git commit ; ... '\".\n+# Be sure to add a space between the command name and the ';'.\n #\n # If you have a command that is not part of git, but you would still\n # like completion, you can use __git_complete:\n\nbase-commit: 23c56f7bd5f1667f8b793d796bf30e39545920f6\n-- \ngitgitgadget\n"},{"id":"481640","messageId":"CAPig+cS2SZqN-viky4OB4hZby7UbbJaBR-vhd=QJoqON7kXuPA@mail.gmail.com","threadId":"60214","inReplyTo":"pull.1585.git.1694274592854.gitgitgadget@gmail.com","subject":"Re: [PATCH] completion: improve doc for complex aliases","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2023-09-10T02:02:24Z","receivedAt":"2023-09-10T02:02:37Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Sep 9, 2023 at 12:25 PM Philippe Blain via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n> The completion code can be told to use a particular completion for\n> aliases that shell out by using ': git <cmd> ;' as the first command of\n> the alias. This only works if <cmd> and the semicolon are separated by a\n> space. The examples have that space but it's not clear if it's just for\n> style or if it's mandatory.\n>\n> Explicitely mention it.\n\ns/Explicitely/Explicitly/\n\n> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n"},{"id":"481723","messageId":"owlyil8gkxrm.fsf@fine.c.googlers.com","threadId":"60214","inReplyTo":"pull.1585.git.1694274592854.gitgitgadget@gmail.com","subject":"Re: [PATCH] completion: improve doc for complex aliases","fromName":"Linus Arver","fromEmail":"linusa@google.com","sentAt":"2023-09-12T01:04:13Z","receivedAt":"2023-09-12T01:13:59Z","isPatch":true,"sender":{"key":"linus@ucla.edu","avatar":null},"body":"Hi Philippe,\n\n\"Philippe Blain via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Philippe Blain <levraiphilippeblain@gmail.com>\n>\n> The completion code can be told to use a particular completion for\n> aliases that shell out by using ': git <cmd> ;' as the first command of\n> the alias. This only works if <cmd> and the semicolon are separated by a\n> space. The examples have that space but it's not clear if it's just for\n> style or if it's mandatory.\n>\n> Explicitely mention it.\n\nIt would be even more helpful if you explain _why_ it is mandatory in\nthe commit message. Is there some Bash-specific behavior or something\nelse going on here?\n\nIf you are unable to explain why, then as an alternative you could\nexplain the error or buggy behavior (any error messages encountered, for\nexample) you observe on your system when you do not use the space (which\nis corrected by applying the suggestion you are adding in this patch).\n\nThanks!\n"},{"id":"481759","messageId":"c84c75cc-a7e2-ae29-71d0-ea41a61a2d23@gmail.com","threadId":"60214","inReplyTo":"owlyil8gkxrm.fsf@fine.c.googlers.com","subject":"Re: [PATCH] completion: improve doc for complex aliases","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2023-09-12T12:13:22Z","receivedAt":"2023-09-12T12:13:16Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Linus,\n\nLe 2023-09-11 à 21:04, Linus Arver a écrit :\n> Hi Philippe,\n> \n> \"Philippe Blain via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n> \n>> From: Philippe Blain <levraiphilippeblain@gmail.com>\n>>\n>> The completion code can be told to use a particular completion for\n>> aliases that shell out by using ': git <cmd> ;' as the first command of\n>> the alias. This only works if <cmd> and the semicolon are separated by a\n>> space. The examples have that space but it's not clear if it's just for\n>> style or if it's mandatory.\n>>\n>> Explicitely mention it.\n> \n> It would be even more helpful if you explain _why_ it is mandatory in\n> the commit message. Is there some Bash-specific behavior or something\n> else going on here?\n> \n> If you are unable to explain why, then as an alternative you could\n> explain the error or buggy behavior (any error messages encountered, for\n> example) you observe on your system when you do not use the space (which\n> is corrected by applying the suggestion you are adding in this patch).\n\nYeah, I guess I did not investigate why it did not work without the space,\nit would be more complete if I did.\n\nThere's no error message though, it just does not work without the space \n(as I wrote in the commit message) in the sense that it won't suggest completion\nfor the git command '<cmd>'.\n\nI'll investigate and update the commit message.\n\nThanks,\nPhilippe.\n"},{"id":"481772","messageId":"pull.1585.v2.git.1694538135853.gitgitgadget@gmail.com","threadId":"60214","inReplyTo":"pull.1585.git.1694274592854.gitgitgadget@gmail.com","subject":"[PATCH v2] completion: improve doc for complex aliases","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-09-12T17:02:15Z","receivedAt":"2023-09-12T17:02:29Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nThe completion code can be told to use a particular completion for\naliases that shell out by using ': git <cmd> ;' as the first command of\nthe alias. This only works if <cmd> and the semicolon are separated by a\nspace, since if the space is missing __git_aliased_command returns (for\nexample) 'checkout;' instead of just 'checkout', and then\n__git_complete_command fails to find a completion for 'checkout;'.\n\nThe examples have that space but it's not clear if it's just for\nstyle or if it's mandatory. Explicitly mention it.\n\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n    completion: improve doc for complex aliases\n    \n    Changes since v1:\n    \n     * fixed the typo pointed out by Eric\n     * added an explanation of why the space is mandatory, as suggested by\n       Linus\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1585%2Fphil-blain%2Fcompletion-shell-aliases-doc-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1585/phil-blain/completion-shell-aliases-doc-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/1585\n\nRange-diff vs v1:\n\n 1:  b3621ed25f0 ! 1:  96a0867c5ad completion: improve doc for complex aliases\n     @@ Commit message\n          The completion code can be told to use a particular completion for\n          aliases that shell out by using ': git <cmd> ;' as the first command of\n          the alias. This only works if <cmd> and the semicolon are separated by a\n     -    space. The examples have that space but it's not clear if it's just for\n     -    style or if it's mandatory.\n     +    space, since if the space is missing __git_aliased_command returns (for\n     +    example) 'checkout;' instead of just 'checkout', and then\n     +    __git_complete_command fails to find a completion for 'checkout;'.\n      \n     -    Explicitely mention it.\n     +    The examples have that space but it's not clear if it's just for\n     +    style or if it's mandatory. Explicitly mention it.\n      \n          Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n      \n\n\n contrib/completion/git-completion.bash | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex dc95c34cc85..659df570496 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -28,6 +28,7 @@\n # completion style.  For example '!f() { : git commit ; ... }; f' will\n # tell the completion to use commit completion.  This also works with aliases\n # of form \"!sh -c '...'\".  For example, \"!sh -c ': git commit ; ... '\".\n+# Be sure to add a space between the command name and the ';'.\n #\n # If you have a command that is not part of git, but you would still\n # like completion, you can use __git_complete:\n\nbase-commit: 23c56f7bd5f1667f8b793d796bf30e39545920f6\n-- \ngitgitgadget\n"},{"id":"481799","messageId":"xmqqo7i6khxv.fsf@gitster.g","threadId":"60214","inReplyTo":"pull.1585.v2.git.1694538135853.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] completion: improve doc for complex aliases","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-09-13T00:58:20Z","receivedAt":"2023-09-13T00:58:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Philippe Blain via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Philippe Blain <levraiphilippeblain@gmail.com>\n>\n> The completion code can be told to use a particular completion for\n> aliases that shell out by using ': git <cmd> ;' as the first command of\n> the alias. This only works if <cmd> and the semicolon are separated by a\n> space, since if the space is missing __git_aliased_command returns (for\n> example) 'checkout;' instead of just 'checkout', and then\n> __git_complete_command fails to find a completion for 'checkout;'.\n>\n> The examples have that space but it's not clear if it's just for\n> style or if it's mandatory. Explicitly mention it.\n>\n> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n> ---\n\nThanks.  I scanned the case statement in the loop in the function\nand thought \"hmph, everybody says ': git <cmd> ;' but is 'git'\nreally needed?\"\n\nI had \"git l3\" alias that invokes \"$HOM#/bin/git-l\" command, like so:\n\n    [alias]\n            l3 = \"!sh -c ': git log ; git l \\\"$@\\\"' -\"\n\nbut if I did 's/: git log/: log/' it still completes just fine.\n\nI wonder if this hack is worth adding, instead of (or in addition\nto) requiring the user to insert $IFS to please the \"parser\", we can\nhonor the rather obvious wish of the user in a more direct way.\n\n\n\n contrib/completion/git-completion.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git c/contrib/completion/git-completion.bash w/contrib/completion/git-completion.bash\nindex 19139ac121..e31d71955f 100644\n--- c/contrib/completion/git-completion.bash\n+++ w/contrib/completion/git-completion.bash\n@@ -1183,7 +1183,7 @@ __git_aliased_command ()\n \t\t\t:)\t: skip null command ;;\n \t\t\t\\'*)\t: skip opening quote after sh -c ;;\n \t\t\t*)\n-\t\t\t\tcur=\"$word\"\n+\t\t\t\tcur=\"${word%;}\"\n \t\t\t\tbreak\n \t\t\tesac\n \t\tdone\n"},{"id":"481857","messageId":"owlymsxojsga.fsf@fine.c.googlers.com","threadId":"60214","inReplyTo":"pull.1585.v2.git.1694538135853.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] completion: improve doc for complex aliases","fromName":"Linus Arver","fromEmail":"linusa@google.com","sentAt":"2023-09-14T22:33:25Z","receivedAt":"2023-09-14T22:33:30Z","isPatch":true,"sender":{"key":"linus@ucla.edu","avatar":null},"body":"\"Philippe Blain via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Philippe Blain <levraiphilippeblain@gmail.com>\n>\n> The completion code can be told to use a particular completion for\n> aliases that shell out by using ': git <cmd> ;' as the first command of\n> the alias. This only works if <cmd> and the semicolon are separated by a\n> space, since if the space is missing __git_aliased_command returns (for\n> example) 'checkout;' instead of just 'checkout', and then\n> __git_complete_command fails to find a completion for 'checkout;'.\n>\n> The examples have that space but it's not clear if it's just for\n> style or if it's mandatory. Explicitly mention it.\n>\n> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n> ---\n>     completion: improve doc for complex aliases\n>     \n>     Changes since v1:\n>     \n>      * fixed the typo pointed out by Eric\n>      * added an explanation of why the space is mandatory, as suggested by\n>        Linus\n>\n\nThanks for the investigation. The commit message reads much better now.\n\nThis LGTM, but I think Junio's review comments [1] are worth\nconsidering. I'll respond there also.\n\n[1] https://lore.kernel.org/git/xmqqo7i6khxv.fsf@gitster.g/#t \n"},{"id":"481859","messageId":"owlyjzssjro2.fsf@fine.c.googlers.com","threadId":"60214","inReplyTo":"xmqqo7i6khxv.fsf@gitster.g","subject":"Re: [PATCH v2] completion: improve doc for complex aliases","fromName":"Linus Arver","fromEmail":"linusa@google.com","sentAt":"2023-09-14T22:50:21Z","receivedAt":"2023-09-14T22:50:24Z","isPatch":true,"sender":{"key":"linus@ucla.edu","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> \"Philippe Blain via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n>\n>> From: Philippe Blain <levraiphilippeblain@gmail.com>\n>>\n>> The completion code can be told to use a particular completion for\n>> aliases that shell out by using ': git <cmd> ;' as the first command of\n>> the alias. This only works if <cmd> and the semicolon are separated by a\n>> space, since if the space is missing __git_aliased_command returns (for\n>> example) 'checkout;' instead of just 'checkout', and then\n>> __git_complete_command fails to find a completion for 'checkout;'.\n>>\n>> The examples have that space but it's not clear if it's just for\n>> style or if it's mandatory. Explicitly mention it.\n>>\n>> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n>> ---\n>\n> Thanks.  I scanned the case statement in the loop in the function\n> and thought \"hmph, everybody says ': git <cmd> ;' but is 'git'\n> really needed?\"\n>\n> I had \"git l3\" alias that invokes \"$HOM#/bin/git-l\" command, like so:\n>\n>     [alias]\n>             l3 = \"!sh -c ': git log ; git l \\\"$@\\\"' -\"\n>\n> but if I did 's/: git log/: log/' it still completes just fine.\n\nInteresting! I searched for the 'git <cmd>' and got some hits in\n\"t9902-completion.sh\" when running \"git grep -nE 'git <cmd>'\":\n\n    t/t9902-completion.sh:2432:test_expect_success \"completion uses <cmd> completion for alias: !sh -c 'git <cmd> ...'\" '\n    t/t9902-completion.sh:2441:test_expect_success 'completion uses <cmd> completion for alias: !f () { VAR=val git <cmd> ... }' '\n    t/t9902-completion.sh:2450:test_expect_success 'completion used <cmd> completion for alias: !f() { : git <cmd> ; ... }' '\n\nWhen I did 's/: git log/: log/' in the test at line 2450, the test still\npassed. Perhaps we should add this \"git\"-less version as another test\ncase?\n\n> I wonder if this hack is worth adding, instead of (or in addition\n> to) requiring the user to insert $IFS to please the \"parser\", we can\n> honor the rather obvious wish of the user in a more direct way.\n>\n>\n>\n>  contrib/completion/git-completion.bash | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git c/contrib/completion/git-completion.bash w/contrib/completion/git-completion.bash\n> index 19139ac121..e31d71955f 100644\n> --- c/contrib/completion/git-completion.bash\n> +++ w/contrib/completion/git-completion.bash\n> @@ -1183,7 +1183,7 @@ __git_aliased_command ()\n>  \t\t\t:)\t: skip null command ;;\n>  \t\t\t\\'*)\t: skip opening quote after sh -c ;;\n>  \t\t\t*)\n> -\t\t\t\tcur=\"$word\"\n> +\t\t\t\tcur=\"${word%;}\"\n>  \t\t\t\tbreak\n>  \t\t\tesac\n>  \t\tdone\n\nI think this is a good defensive technique. This obviously changes the\nguidance that Phillipe gave in their patch (we no longer have to worry\nabout adding a space or not between \"word\" and \";\", so there's no need\nto mention this explicitly any more), but to me this seems like a better\nexperience for our users because it's one less thing they have to worry\nabout.\n"},{"id":"482080","messageId":"xmqqy1h08zsp.fsf_-_@gitster.g","threadId":"60214","inReplyTo":"pull.1585.v2.git.1694538135853.gitgitgadget@gmail.com","subject":"[PATCH] completion: loosen and document the requirement around completing alias","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-09-20T18:28:22Z","receivedAt":"2023-09-20T18:28:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Recently we started to tell users to spell \": git foo ;\" with\nspace(s) around 'foo' for an alias to be completed similarly\nto the 'git foo' command.  It however is easy to also allow users to\nspell it in a more natural way with the semicolon attached to 'foo',\ni.e. \": git foo;\".  Also, add a comment to note that 'git' is optional\nand writing \": foo;\" would complete the alias just fine.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * We've discussed this when we reviewed the topic that just hit\n   'master'.  Before we forget...\n\n contrib/completion/git-completion.bash | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git c/contrib/completion/git-completion.bash w/contrib/completion/git-completion.bash\nindex 47fd664ea5..477ef8157a 100644\n--- c/contrib/completion/git-completion.bash\n+++ w/contrib/completion/git-completion.bash\n@@ -28,7 +28,8 @@\n # completion style.  For example '!f() { : git commit ; ... }; f' will\n # tell the completion to use commit completion.  This also works with aliases\n # of form \"!sh -c '...'\".  For example, \"!sh -c ': git commit ; ... '\".\n-# Be sure to add a space between the command name and the ';'.\n+# Note that \"git\" is optional --- '!f() { : commit; ...}; f' would complete\n+# just like the 'git commit' command.\n #\n # If you have a command that is not part of git, but you would still\n # like completion, you can use __git_complete:\n@@ -1183,7 +1184,7 @@ __git_aliased_command ()\n \t\t\t:)\t: skip null command ;;\n \t\t\t\\'*)\t: skip opening quote after sh -c ;;\n \t\t\t*)\n-\t\t\t\tcur=\"$word\"\n+\t\t\t\tcur=\"${word%;}\"\n \t\t\t\tbreak\n \t\t\tesac\n \t\tdone\n"},{"id":"482081","messageId":"xmqqr0ms8yxs.fsf@gitster.g","threadId":"60214","inReplyTo":"xmqqy1h08zsp.fsf_-_@gitster.g","subject":"Re: [PATCH] completion: loosen and document the requirement around completing alias","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-09-20T18:46:55Z","receivedAt":"2023-09-20T18:47:05Z","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>  * We've discussed this when we reviewed the topic that just hit\n>    'master'.  Before we forget...\n>\n>  contrib/completion/git-completion.bash | 5 +++--\n>  1 file changed, 3 insertions(+), 2 deletions(-)\n\nAnd here is an obligatory \"test\" update I will squash into the main\npatch.  The new ones copy a canonical \": git <cmd> ; ...\"  test and\nremove 'git' and also the space before the semicolon.\n\ndiff --git c/t/t9902-completion.sh w/t/t9902-completion.sh\nindex 47e20fb8b1..a7c3b4eb63 100755\n--- c/t/t9902-completion.sh\n+++ w/t/t9902-completion.sh\n@@ -2464,6 +2464,24 @@ test_expect_success 'completion used <cmd> completion for alias: !f() { : git <c\n \tEOF\n '\n \n+test_expect_success 'completion used <cmd> completion for alias: !f() { : <cmd> ; ... }' '\n+\ttest_config alias.co \"!f() { : checkout ; if ... } f\" &&\n+\ttest_completion \"git co m\" <<-\\EOF\n+\tmain Z\n+\tmybranch Z\n+\tmytag Z\n+\tEOF\n+'\n+\n+test_expect_success 'completion used <cmd> completion for alias: !f() { : <cmd>; ... }' '\n+\ttest_config alias.co \"!f() { : checkout; if ... } f\" &&\n+\ttest_completion \"git co m\" <<-\\EOF\n+\tmain Z\n+\tmybranch Z\n+\tmytag Z\n+\tEOF\n+'\n+\n test_expect_success 'completion without explicit _git_xxx function' '\n \ttest_completion \"git version --\" <<-\\EOF\n \t--build-options Z\n"},{"id":"482163","messageId":"owly34z6t5zg.fsf@fine.c.googlers.com","threadId":"60214","inReplyTo":"xmqqr0ms8yxs.fsf@gitster.g","subject":"Re: [PATCH] completion: loosen and document the requirement around completing alias","fromName":"Linus Arver","fromEmail":"linusa@google.com","sentAt":"2023-09-22T18:31:15Z","receivedAt":"2023-09-22T18:31:21Z","isPatch":true,"sender":{"key":"linus@ucla.edu","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>>  * We've discussed this when we reviewed the topic that just hit\n>>    'master'.  Before we forget...\n>>\n>>  contrib/completion/git-completion.bash | 5 +++--\n>>  1 file changed, 3 insertions(+), 2 deletions(-)\n>\n> And here is an obligatory \"test\" update I will squash into the main\n> patch.  The new ones copy a canonical \": git <cmd> ; ...\"  test and\n> remove 'git' and also the space before the semicolon.\n>\n> diff --git c/t/t9902-completion.sh w/t/t9902-completion.sh\n> index 47e20fb8b1..a7c3b4eb63 100755\n> --- c/t/t9902-completion.sh\n> +++ w/t/t9902-completion.sh\n> @@ -2464,6 +2464,24 @@ test_expect_success 'completion used <cmd> completion for alias: !f() { : git <c\n>  \tEOF\n>  '\n>  \n> +test_expect_success 'completion used <cmd> completion for alias: !f() { : <cmd> ; ... }' '\n> +\ttest_config alias.co \"!f() { : checkout ; if ... } f\" &&\n> +\ttest_completion \"git co m\" <<-\\EOF\n> +\tmain Z\n> +\tmybranch Z\n> +\tmytag Z\n> +\tEOF\n> +'\n> +\n> +test_expect_success 'completion used <cmd> completion for alias: !f() { : <cmd>; ... }' '\n> +\ttest_config alias.co \"!f() { : checkout; if ... } f\" &&\n> +\ttest_completion \"git co m\" <<-\\EOF\n> +\tmain Z\n> +\tmybranch Z\n> +\tmytag Z\n> +\tEOF\n> +'\n> +\n>  test_expect_success 'completion without explicit _git_xxx function' '\n>  \ttest_completion \"git version --\" <<-\\EOF\n>  \t--build-options Z\n\nLGTM, thanks!\n"},{"id":"482170","messageId":"xmqqediq0z0t.fsf@gitster.g","threadId":"60214","inReplyTo":"owly34z6t5zg.fsf@fine.c.googlers.com","subject":"Re: [PATCH] completion: loosen and document the requirement around completing alias","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-09-22T19:49:06Z","receivedAt":"2023-09-22T19:49:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Arver <linusa@google.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>>>  * We've discussed this when we reviewed the topic that just hit\n>>>    'master'.  Before we forget...\n> ...\n> LGTM, thanks!\n\nThanks for reading.\n"}]}