completion: bash: fix prefix detection in branch.*

Otherwise we are completely ignoring the --cur argument.

The issue can be tested with:

  git clone --config=branch.<tab>

Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
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:
Felipe Contreras 2021-08-16 04:10:22 -05:00 committed by Junio C Hamano
parent ebf3c04b26
commit bf8ae49a8f

View file

@ -2649,8 +2649,8 @@ __git_complete_config_variable_name ()
return
;;
branch.*)
local pfx="${cur%.*}."
cur_="${cur#*.}"
local pfx="${cur_%.*}."
cur_="${cur_#*.}"
__gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
__gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "$sfx"
return