Re: [PATCH] completion: loosen and document the requirement around completing alias
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 20, 2023, 18:46 UTC
- Message-ID
- <xmqqr0ms8yxs.fsf@gitster.g>
- In-Reply-To
- <xmqqy1h08zsp.fsf_-_@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
> * 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