mirror of
https://github.com/git/git
synced 2024-08-28 03:59:25 +00:00
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>
This commit is contained in:
parent
bf8ae49a8f
commit
e9f2118ddf
|
@ -356,7 +356,7 @@ __gitcomp ()
|
||||||
local cur_="${3-$cur}"
|
local cur_="${3-$cur}"
|
||||||
|
|
||||||
case "$cur_" in
|
case "$cur_" in
|
||||||
--*=)
|
*=)
|
||||||
;;
|
;;
|
||||||
--no-*)
|
--no-*)
|
||||||
local c i=0 IFS=$' \t\n'
|
local c i=0 IFS=$' \t\n'
|
||||||
|
|
|
@ -540,6 +540,15 @@ test_expect_success '__gitcomp - expand/narrow all negative options' '
|
||||||
EOF
|
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' '
|
test_expect_success '__gitcomp - doesnt fail because of invalid variable name' '
|
||||||
__gitcomp "$invalid_variable_name"
|
__gitcomp "$invalid_variable_name"
|
||||||
'
|
'
|
||||||
|
@ -2380,6 +2389,12 @@ test_expect_success 'git clone --config= - value' '
|
||||||
EOF
|
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' '
|
test_expect_success 'sourcing the completion script clears cached commands' '
|
||||||
__git_compute_all_commands &&
|
__git_compute_all_commands &&
|
||||||
verbose test -n "$__git_all_commands" &&
|
verbose test -n "$__git_all_commands" &&
|
||||||
|
|
Loading…
Reference in a new issue