File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed
Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -356,7 +356,7 @@ __gitcomp ()
356356 local cur_=" ${3-$cur } "
357357
358358 case " $cur_ " in
359- -- * =)
359+ * =)
360360 ;;
361361 --no-* )
362362 local c i=0 IFS=$' \t\n '
@@ -421,7 +421,7 @@ __gitcomp_builtin ()
421421 local incl=" ${2-} "
422422 local excl=" ${3-} "
423423
424- local var=__gitcomp_builtin_" ${cmd/ -/ _} "
424+ local var=__gitcomp_builtin_" ${cmd// -/ _} "
425425 local options
426426 eval " options=\$ {$var -}"
427427
@@ -2650,10 +2650,10 @@ __git_complete_config_variable_name ()
26502650 return
26512651 ;;
26522652 branch.* )
2653- local pfx=" ${cur % .* } ."
2654- cur_=" ${cur #* .} "
2653+ local pfx=" ${cur_ % .* } ."
2654+ cur_=" ${cur_ #* .} "
26552655 __gitcomp_direct " $( __git_heads " $pfx " " $cur_ " " ." ) "
2656- __gitcomp_nl_append $' autoSetupMerge\n autoSetupRebase\n ' " $pfx " " $cur_ " " $sfx "
2656+ __gitcomp_nl_append $' autoSetupMerge\n autoSetupRebase\n ' " $pfx " " $cur_ " " ${ sfx- } "
26572657 return
26582658 ;;
26592659 guitool.* .* )
@@ -2687,7 +2687,7 @@ __git_complete_config_variable_name ()
26872687 local pfx=" ${cur_% .* } ."
26882688 cur_=" ${cur_#* .} "
26892689 __git_compute_all_commands
2690- __gitcomp_nl " $__git_all_commands " " $pfx " " $cur_ " " $sfx "
2690+ __gitcomp_nl " $__git_all_commands " " $pfx " " $cur_ " " ${ sfx- } "
26912691 return
26922692 ;;
26932693 remote.* .* )
@@ -2703,7 +2703,7 @@ __git_complete_config_variable_name ()
27032703 local pfx=" ${cur_% .* } ."
27042704 cur_=" ${cur_#* .} "
27052705 __gitcomp_nl " $( __git_remotes) " " $pfx " " $cur_ " " ."
2706- __gitcomp_nl_append " pushDefault" " $pfx " " $cur_ " " $sfx "
2706+ __gitcomp_nl_append " pushDefault" " $pfx " " $cur_ " " ${ sfx- } "
27072707 return
27082708 ;;
27092709 url.* .* )
Original file line number Diff line number Diff line change @@ -540,6 +540,15 @@ test_expect_success '__gitcomp - expand/narrow all negative options' '
540540 EOF
541541'
542542
543+ test_expect_success ' __gitcomp - equal skip' '
544+ test_gitcomp "--option=" "--option=" <<-\EOF &&
545+
546+ EOF
547+ test_gitcomp "option=" "option=" <<-\EOF
548+
549+ EOF
550+ '
551+
543552test_expect_success ' __gitcomp - doesnt fail because of invalid variable name' '
544553 __gitcomp "$invalid_variable_name"
545554'
@@ -2380,6 +2389,12 @@ test_expect_success 'git clone --config= - value' '
23802389 EOF
23812390'
23822391
2392+ test_expect_success ' options with value' '
2393+ test_completion "git merge -X diff-algorithm=" <<-\EOF
2394+
2395+ EOF
2396+ '
2397+
23832398test_expect_success ' sourcing the completion script clears cached commands' '
23842399 __git_compute_all_commands &&
23852400 verbose test -n "$__git_all_commands" &&
You can’t perform that action at this time.
0 commit comments