2596
__git_config_vars="$(git help --config-for-completion)"
2597
}
2598
2599
+__git_config_vars_all=
2600
+__git_compute_config_vars_all ()
2601
+{
2602
+ test -n "$__git_config_vars_all" ||
2603
+ __git_config_vars_all="$(git --no-pager help --config)"
2604
+}
2605
+
2606
__git_compute_first_level_config_vars_for_section ()
2607
{
2608
local section="$1"
2612
printf -v "__git_first_level_config_vars_for_section_${section}" %s "$(echo "$__git_config_vars" | grep -E "^${section}\.[a-z]" | awk -F. '{print $2}')"
2613
}
2614
2615
+__git_compute_second_level_config_vars_for_section ()
2616
+{
2617
+ local section="$1"
2618
+ __git_compute_config_vars_all
2619
+ local this_section="__git_second_level_config_vars_for_section_${section}"
2620
+ test -n "${!this_section}" ||
2621
+ printf -v "__git_second_level_config_vars_for_section_${section}" %s "$(echo "$__git_config_vars_all" | grep -E "^${section}\.<" | awk -F. '{print $3}')"
2622
+}
2623
+
2624
__git_config_sections=
2625
__git_compute_config_sections ()
2626
{
2765
done
2766
2767
case "$cur_" in
2752
- branch.*.*)
2768
+ branch.*.*|guitool.*.*|difftool.*.*|man.*.*|mergetool.*.*|remote.*.*|submodule.*.*|url.*.*)
2769
local pfx="${cur_%.*}."
2770
cur_="${cur_##*.}"
2755
- __gitcomp "remote pushRemote merge mergeOptions rebase" "$pfx" "$cur_" "$sfx"
2771
+ local section="${pfx%.*.}"
2772
+ __git_compute_second_level_config_vars_for_section "${section}"
2773
+ local this_section="__git_second_level_config_vars_for_section_${section}"
2774
+ __gitcomp "${!this_section}" "$pfx" "$cur_" "$sfx"
2775
return
2776
;;
2777
branch.*)
2784
__gitcomp_nl_append "${!this_section}" "$pfx" "$cur_" "${sfx:- }"
2785
return
2786
;;
2768
- guitool.*.*)
2769
- local pfx="${cur_%.*}."
2770
- cur_="${cur_##*.}"
2771
- __gitcomp "
2772
- argPrompt cmd confirm needsFile noConsole noRescan
2773
- prompt revPrompt revUnmerged title
2774
- " "$pfx" "$cur_" "$sfx"
2775
- return
2776
- ;;
2777
- difftool.*.*)
2778
- local pfx="${cur_%.*}."
2779
- cur_="${cur_##*.}"
2780
- __gitcomp "cmd path" "$pfx" "$cur_" "$sfx"
2781
- return
2782
- ;;
2783
- man.*.*)
2784
- local pfx="${cur_%.*}."
2785
- cur_="${cur_##*.}"
2786
- __gitcomp "cmd path" "$pfx" "$cur_" "$sfx"
2787
- return
2788
- ;;
2789
- mergetool.*.*)
2790
- local pfx="${cur_%.*}."
2791
- cur_="${cur_##*.}"
2792
- __gitcomp "cmd path trustExitCode" "$pfx" "$cur_" "$sfx"
2793
- return
2794
- ;;
2787
pager.*)
2788
local pfx="${cur_%.*}."
2789
cur_="${cur_#*.}"
2791
__gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "${sfx:- }"
2792
return
2793
;;
2802
- remote.*.*)
2803
- local pfx="${cur_%.*}."
2804
- cur_="${cur_##*.}"
2805
- __gitcomp "
2806
- url proxy fetch push mirror skipDefaultUpdate
2807
- receivepack uploadpack tagOpt pushurl
2808
- " "$pfx" "$cur_" "$sfx"
2809
- return
2810
- ;;
2794
remote.*)
2795
local pfx="${cur_%.*}."
2796
cur_="${cur_#*.}"
2801
__gitcomp_nl_append "${!this_section}" "$pfx" "$cur_" "${sfx:- }"
2802
return
2803
;;
2821
- submodule.*.*)
2822
- local pfx="${cur_%.*}."
2823
- cur_="${cur_##*.}"
2824
- __gitcomp "url update branch fetchRecurseSubmodules ignore active" "$pfx" "$cur_" "$sfx"
2825
- return
2826
- ;;
2804
submodule.*)
2805
local pfx="${cur_%.*}."
2806
cur_="${cur_#*.}"
2811
__gitcomp_nl_append "${!this_section}" "$pfx" "$cur_" "${sfx:- }"
2812
return
2813
;;
2837
- url.*.*)
2838
- local pfx="${cur_%.*}."
2839
- cur_="${cur_##*.}"
2840
- __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_" "$sfx"
2841
- return
2842
- ;;
2814
*.*)
2815
__git_compute_config_vars
2816
__gitcomp "$__git_config_vars" "" "$cur_" "$sfx"