]> git.ipfire.org Git - thirdparty/git.git/commitdiff
completion: bash: fix prefix detection in branch.*
authorFelipe Contreras <felipe.contreras@gmail.com>
Mon, 16 Aug 2021 09:10:22 +0000 (04:10 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 18 Aug 2021 18:17:25 +0000 (11:17 -0700)
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>
contrib/completion/git-completion.bash

index b50c5d0ea3867bd5def9865efa626af25d4567b1..47b48fbab6614e73bfee7500e1c1c88b0ce4b608 100644 (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