summaryrefslogtreecommitdiff
path: root/t/t9902-completion.sh
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2021-08-16 09:10:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-08-18 18:17:25 (GMT)
commite9f2118ddfad4ae5e37adc7637acc9daf4ac8c9c (patch)
treea2e76e6f3578becdb0da937d842d07d331305283 /t/t9902-completion.sh
parentbf8ae49a8f7d8b6dd87bbea34e6566e8581ab231 (diff)
downloadgit-e9f2118ddfad4ae5e37adc7637acc9daf4ac8c9c.zip
git-e9f2118ddfad4ae5e37adc7637acc9daf4ac8c9c.tar.gz
git-e9f2118ddfad4ae5e37adc7637acc9daf4ac8c9c.tar.bz2
completion: bash: fix for suboptions with value
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> Tested-by: David Aguilar <davvid@gmail.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9902-completion.sh')
-rwxr-xr-xt/t9902-completion.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index cb057ef..6b56e54 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -540,6 +540,15 @@ test_expect_success '__gitcomp - expand/narrow all negative options' '
EOF
'
+test_expect_success '__gitcomp - equal skip' '
+ test_gitcomp "--option=" "--option=" <<-\EOF &&
+
+ EOF
+ test_gitcomp "option=" "option=" <<-\EOF
+
+ EOF
+'
+
test_expect_success '__gitcomp - doesnt fail because of invalid variable name' '
__gitcomp "$invalid_variable_name"
'
@@ -2380,6 +2389,12 @@ test_expect_success 'git clone --config= - value' '
EOF
'
+test_expect_success 'options with value' '
+ test_completion "git merge -X diff-algorithm=" <<-\EOF
+
+ EOF
+'
+
test_expect_success 'sourcing the completion script clears cached commands' '
__git_compute_all_commands &&
verbose test -n "$__git_all_commands" &&