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 ()
356
356
local cur_=" ${3-$cur } "
357
357
358
358
case " $cur_ " in
359
- -- * =)
359
+ * =)
360
360
;;
361
361
--no-* )
362
362
local c i=0 IFS=$' \t\n '
@@ -421,7 +421,7 @@ __gitcomp_builtin ()
421
421
local incl=" ${2-} "
422
422
local excl=" ${3-} "
423
423
424
- local var=__gitcomp_builtin_" ${cmd/ -/ _} "
424
+ local var=__gitcomp_builtin_" ${cmd// -/ _} "
425
425
local options
426
426
eval " options=\$ {$var -}"
427
427
@@ -2650,10 +2650,10 @@ __git_complete_config_variable_name ()
2650
2650
return
2651
2651
;;
2652
2652
branch.* )
2653
- local pfx=" ${cur % .* } ."
2654
- cur_=" ${cur #* .} "
2653
+ local pfx=" ${cur_ % .* } ."
2654
+ cur_=" ${cur_ #* .} "
2655
2655
__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- } "
2657
2657
return
2658
2658
;;
2659
2659
guitool.* .* )
@@ -2687,7 +2687,7 @@ __git_complete_config_variable_name ()
2687
2687
local pfx=" ${cur_% .* } ."
2688
2688
cur_=" ${cur_#* .} "
2689
2689
__git_compute_all_commands
2690
- __gitcomp_nl " $__git_all_commands " " $pfx " " $cur_ " " $sfx "
2690
+ __gitcomp_nl " $__git_all_commands " " $pfx " " $cur_ " " ${ sfx- } "
2691
2691
return
2692
2692
;;
2693
2693
remote.* .* )
@@ -2703,7 +2703,7 @@ __git_complete_config_variable_name ()
2703
2703
local pfx=" ${cur_% .* } ."
2704
2704
cur_=" ${cur_#* .} "
2705
2705
__gitcomp_nl " $( __git_remotes) " " $pfx " " $cur_ " " ."
2706
- __gitcomp_nl_append " pushDefault" " $pfx " " $cur_ " " $sfx "
2706
+ __gitcomp_nl_append " pushDefault" " $pfx " " $cur_ " " ${ sfx- } "
2707
2707
return
2708
2708
;;
2709
2709
url.* .* )
Original file line number Diff line number Diff line change @@ -540,6 +540,15 @@ test_expect_success '__gitcomp - expand/narrow all negative options' '
540
540
EOF
541
541
'
542
542
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
+
543
552
test_expect_success ' __gitcomp - doesnt fail because of invalid variable name' '
544
553
__gitcomp "$invalid_variable_name"
545
554
'
@@ -2380,6 +2389,12 @@ test_expect_success 'git clone --config= - value' '
2380
2389
EOF
2381
2390
'
2382
2391
2392
+ test_expect_success ' options with value' '
2393
+ test_completion "git merge -X diff-algorithm=" <<-\EOF
2394
+
2395
+ EOF
2396
+ '
2397
+
2383
2398
test_expect_success ' sourcing the completion script clears cached commands' '
2384
2399
__git_compute_all_commands &&
2385
2400
verbose test -n "$__git_all_commands" &&
You can’t perform that action at this time.
0 commit comments