[PATCH v7 10/49] completion: fix for suboptions with value
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Apr 1, 2023, 08:45 UTC
- Message-ID
- <20230401084626.304356-11-felipe.contreras@gmail.com>
- In-Reply-To
- <20230401084626.304356-1-felipe.contreras@gmail.com>
We need to ignore options that don't start with -- as well.
Depending on the value of COMP_WORDBREAKS, the last word could be duplicated otherwise.
Can be tested with:
git merge -X diff-algorithm=<tab>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> --- contrib/completion/git-completion.zsh | 2 +- t/t9904-completion-zsh.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh index d11f4765b6..13809f7894 100644 --- a/contrib/completion/git-completion.zsh +++ b/contrib/completion/git-completion.zsh @@ -56,7 +56,7 @@ __gitcomp () local cur_="${3-$cur}" case "$cur_" in - --*=) + *=) ;; --no-*) local c IFS=$' \t\n' diff --git a/t/t9904-completion-zsh.sh b/t/t9904-completion-zsh.sh index b7e4029bf9..994d57a67f 100755 --- a/t/t9904-completion-zsh.sh +++ b/t/t9904-completion-zsh.sh @@ -176,7 +176,7 @@ test_expect_success '__gitcomp - expand/narrow all negative options' ' EOF ' -test_expect_failure '__gitcomp - equal skip' ' +test_expect_success '__gitcomp - equal skip' ' test_gitcomp "--option=" "--option=" <<-\EOF && EOF @@ -1134,7 +1134,7 @@ test_expect_success 'git clone --config= - value' ' EOF ' -test_expect_failure 'options with value' ' +test_expect_success 'options with value' ' test_completion "git merge -X diff-algorithm=" <<-\EOF EOF
-- 2.33.0