Skip to content

Commit c032b1d

Browse files
committed
Merge branch 'dk/zsh-config-completion-fix'
Completion script updates for zsh * dk/zsh-config-completion-fix: completion: repair config completion for Zsh
2 parents 780f7fd + 8776470 commit c032b1d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

contrib/completion/git-completion.bash

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2737,12 +2737,17 @@ __git_compute_config_vars_all ()
27372737
__git_config_vars_all="$(git --no-pager help --config)"
27382738
}
27392739

2740+
__git_indirect()
2741+
{
2742+
eval printf '%s' "\"\$$1\""
2743+
}
2744+
27402745
__git_compute_first_level_config_vars_for_section ()
27412746
{
27422747
local section="$1"
27432748
__git_compute_config_vars
27442749
local this_section="__git_first_level_config_vars_for_section_${section}"
2745-
test -n "${!this_section}" ||
2750+
test -n "$(__git_indirect "${this_section}")" ||
27462751
printf -v "__git_first_level_config_vars_for_section_${section}" %s \
27472752
"$(echo "$__git_config_vars" | awk -F. "/^${section}\.[a-z]/ { print \$2 }")"
27482753
}
@@ -2752,7 +2757,7 @@ __git_compute_second_level_config_vars_for_section ()
27522757
local section="$1"
27532758
__git_compute_config_vars_all
27542759
local this_section="__git_second_level_config_vars_for_section_${section}"
2755-
test -n "${!this_section}" ||
2760+
test -n "$(__git_indirect "${this_section}")" ||
27562761
printf -v "__git_second_level_config_vars_for_section_${section}" %s \
27572762
"$(echo "$__git_config_vars_all" | awk -F. "/^${section}\.</ { print \$3 }")"
27582763
}
@@ -2907,7 +2912,7 @@ __git_complete_config_variable_name ()
29072912
local section="${pfx%.*.}"
29082913
__git_compute_second_level_config_vars_for_section "${section}"
29092914
local this_section="__git_second_level_config_vars_for_section_${section}"
2910-
__gitcomp "${!this_section}" "$pfx" "$cur_" "$sfx"
2915+
__gitcomp "$(__git_indirect "${this_section}")" "$pfx" "$cur_" "$sfx"
29112916
return
29122917
;;
29132918
branch.*)
@@ -2917,7 +2922,7 @@ __git_complete_config_variable_name ()
29172922
__gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
29182923
__git_compute_first_level_config_vars_for_section "${section}"
29192924
local this_section="__git_first_level_config_vars_for_section_${section}"
2920-
__gitcomp_nl_append "${!this_section}" "$pfx" "$cur_" "${sfx:- }"
2925+
__gitcomp_nl_append "$(__git_indirect "${this_section}")" "$pfx" "$cur_" "${sfx:- }"
29212926
return
29222927
;;
29232928
pager.*)
@@ -2934,7 +2939,7 @@ __git_complete_config_variable_name ()
29342939
__gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "."
29352940
__git_compute_first_level_config_vars_for_section "${section}"
29362941
local this_section="__git_first_level_config_vars_for_section_${section}"
2937-
__gitcomp_nl_append "${!this_section}" "$pfx" "$cur_" "${sfx:- }"
2942+
__gitcomp_nl_append "$(__git_indirect "${this_section}")" "$pfx" "$cur_" "${sfx:- }"
29382943
return
29392944
;;
29402945
submodule.*)
@@ -2944,7 +2949,7 @@ __git_complete_config_variable_name ()
29442949
__gitcomp_nl "$(__git config -f "$(__git rev-parse --show-toplevel)/.gitmodules" --get-regexp 'submodule.*.path' | awk -F. '{print $2}')" "$pfx" "$cur_" "."
29452950
__git_compute_first_level_config_vars_for_section "${section}"
29462951
local this_section="__git_first_level_config_vars_for_section_${section}"
2947-
__gitcomp_nl_append "${!this_section}" "$pfx" "$cur_" "${sfx:- }"
2952+
__gitcomp_nl_append "$(__git_indirect "${this_section}")" "$pfx" "$cur_" "${sfx:- }"
29482953
return
29492954
;;
29502955
*.*)

0 commit comments

Comments
 (0)