git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Philippe Blain <levraiphilippeblain@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] completion: loosen and document the requirement around completing alias
Date: Wed, 20 Sep 2023 11:46:55 -0700	[thread overview]
Message-ID: <xmqqr0ms8yxs.fsf@gitster.g> (raw)
In-Reply-To: <xmqqy1h08zsp.fsf_-_@gitster.g> (Junio C. Hamano's message of "Wed, 20 Sep 2023 11:28:22 -0700")

Junio C Hamano <gitster@pobox.com> writes:

>  * We've discussed this when we reviewed the topic that just hit
>    'master'.  Before we forget...
>
>  contrib/completion/git-completion.bash | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

And here is an obligatory "test" update I will squash into the main
patch.  The new ones copy a canonical ": git <cmd> ; ..."  test and
remove 'git' and also the space before the semicolon.

diff --git c/t/t9902-completion.sh w/t/t9902-completion.sh
index 47e20fb8b1..a7c3b4eb63 100755
--- c/t/t9902-completion.sh
+++ w/t/t9902-completion.sh
@@ -2464,6 +2464,24 @@ test_expect_success 'completion used <cmd> completion for alias: !f() { : git <c
 	EOF
 '
 
+test_expect_success 'completion used <cmd> completion for alias: !f() { : <cmd> ; ... }' '
+	test_config alias.co "!f() { : checkout ; if ... } f" &&
+	test_completion "git co m" <<-\EOF
+	main Z
+	mybranch Z
+	mytag Z
+	EOF
+'
+
+test_expect_success 'completion used <cmd> completion for alias: !f() { : <cmd>; ... }' '
+	test_config alias.co "!f() { : checkout; if ... } f" &&
+	test_completion "git co m" <<-\EOF
+	main Z
+	mybranch Z
+	mytag Z
+	EOF
+'
+
 test_expect_success 'completion without explicit _git_xxx function' '
 	test_completion "git version --" <<-\EOF
 	--build-options Z

  reply	other threads:[~2023-09-20 18:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-09 15:49 [PATCH] completion: improve doc for complex aliases Philippe Blain via GitGitGadget
2023-09-10  2:02 ` Eric Sunshine
2023-09-12  1:04 ` Linus Arver
2023-09-12 12:13   ` Philippe Blain
2023-09-12 17:02 ` [PATCH v2] " Philippe Blain via GitGitGadget
2023-09-13  0:58   ` Junio C Hamano
2023-09-14 22:50     ` Linus Arver
2023-09-14 22:33   ` Linus Arver
2023-09-20 18:28   ` [PATCH] completion: loosen and document the requirement around completing alias Junio C Hamano
2023-09-20 18:46     ` Junio C Hamano [this message]
2023-09-22 18:31       ` Linus Arver
2023-09-22 19:49         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqr0ms8yxs.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=levraiphilippeblain@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).