@@ -2660,6 +2660,31 @@ __git_compute_config_vars ()
26602660 __git_config_vars=" $( git help --config-for-completion) "
26612661}
26622662
2663+ __git_config_vars_all=
2664+ __git_compute_config_vars_all ()
2665+ {
2666+ test -n " $__git_config_vars_all " ||
2667+ __git_config_vars_all=" $( git --no-pager help --config) "
2668+ }
2669+
2670+ __git_compute_first_level_config_vars_for_section ()
2671+ {
2672+ local section=" $1 "
2673+ __git_compute_config_vars
2674+ local this_section=" __git_first_level_config_vars_for_section_${section} "
2675+ test -n " ${! this_section} " ||
2676+ printf -v " __git_first_level_config_vars_for_section_${section} " %s " $( echo " $__git_config_vars " | grep -E " ^${section} \.[a-z]" | awk -F. ' {print $2}' ) "
2677+ }
2678+
2679+ __git_compute_second_level_config_vars_for_section ()
2680+ {
2681+ local section=" $1 "
2682+ __git_compute_config_vars_all
2683+ local this_section=" __git_second_level_config_vars_for_section_${section} "
2684+ test -n " ${! this_section} " ||
2685+ printf -v " __git_second_level_config_vars_for_section_${section} " %s " $( echo " $__git_config_vars_all " | grep -E " ^${section} \.<" | awk -F. ' {print $3}' ) "
2686+ }
2687+
26632688__git_config_sections=
26642689__git_compute_config_sections ()
26652690{
@@ -2804,73 +2829,50 @@ __git_complete_config_variable_name ()
28042829 done
28052830
28062831 case " $cur_ " in
2807- branch.* .* )
2832+ branch.* .* |guitool. * . * |difftool. * . * |man. * . * |mergetool. * . * |remote. * . * |submodule. * . * |url. * . * )
28082833 local pfx=" ${cur_% .* } ."
28092834 cur_=" ${cur_##* .} "
2810- __gitcomp " remote pushRemote merge mergeOptions rebase" " $pfx " " $cur_ " " $sfx "
2835+ local section=" ${pfx% .* .} "
2836+ __git_compute_second_level_config_vars_for_section " ${section} "
2837+ local this_section=" __git_second_level_config_vars_for_section_${section} "
2838+ __gitcomp " ${! this_section} " " $pfx " " $cur_ " " $sfx "
28112839 return
28122840 ;;
28132841 branch.* )
28142842 local pfx=" ${cur_% .* } ."
28152843 cur_=" ${cur_#* .} "
2844+ local section=" ${pfx% .} "
28162845 __gitcomp_direct " $( __git_heads " $pfx " " $cur_ " " ." ) "
2817- __gitcomp_nl_append $' autoSetupMerge\n autoSetupRebase\n ' " $pfx " " $cur_ " " ${sfx- } "
2818- return
2819- ;;
2820- guitool.* .* )
2821- local pfx=" ${cur_% .* } ."
2822- cur_=" ${cur_##* .} "
2823- __gitcomp "
2824- argPrompt cmd confirm needsFile noConsole noRescan
2825- prompt revPrompt revUnmerged title
2826- " " $pfx " " $cur_ " " $sfx "
2827- return
2828- ;;
2829- difftool.* .* )
2830- local pfx=" ${cur_% .* } ."
2831- cur_=" ${cur_##* .} "
2832- __gitcomp " cmd path" " $pfx " " $cur_ " " $sfx "
2833- return
2834- ;;
2835- man.* .* )
2836- local pfx=" ${cur_% .* } ."
2837- cur_=" ${cur_##* .} "
2838- __gitcomp " cmd path" " $pfx " " $cur_ " " $sfx "
2839- return
2840- ;;
2841- mergetool.* .* )
2842- local pfx=" ${cur_% .* } ."
2843- cur_=" ${cur_##* .} "
2844- __gitcomp " cmd path trustExitCode" " $pfx " " $cur_ " " $sfx "
2846+ __git_compute_first_level_config_vars_for_section " ${section} "
2847+ local this_section=" __git_first_level_config_vars_for_section_${section} "
2848+ __gitcomp_nl_append " ${! this_section} " " $pfx " " $cur_ " " ${sfx:- } "
28452849 return
28462850 ;;
28472851 pager.* )
28482852 local pfx=" ${cur_% .* } ."
28492853 cur_=" ${cur_#* .} "
28502854 __git_compute_all_commands
2851- __gitcomp_nl " $__git_all_commands " " $pfx " " $cur_ " " ${sfx- } "
2852- return
2853- ;;
2854- remote.* .* )
2855- local pfx=" ${cur_% .* } ."
2856- cur_=" ${cur_##* .} "
2857- __gitcomp "
2858- url proxy fetch push mirror skipDefaultUpdate
2859- receivepack uploadpack tagOpt pushurl
2860- " " $pfx " " $cur_ " " $sfx "
2855+ __gitcomp_nl " $__git_all_commands " " $pfx " " $cur_ " " ${sfx:- } "
28612856 return
28622857 ;;
28632858 remote.* )
28642859 local pfx=" ${cur_% .* } ."
28652860 cur_=" ${cur_#* .} "
2861+ local section=" ${pfx% .} "
28662862 __gitcomp_nl " $( __git_remotes) " " $pfx " " $cur_ " " ."
2867- __gitcomp_nl_append " pushDefault" " $pfx " " $cur_ " " ${sfx- } "
2863+ __git_compute_first_level_config_vars_for_section " ${section} "
2864+ local this_section=" __git_first_level_config_vars_for_section_${section} "
2865+ __gitcomp_nl_append " ${! this_section} " " $pfx " " $cur_ " " ${sfx:- } "
28682866 return
28692867 ;;
2870- url. * .* )
2868+ submodule .* )
28712869 local pfx=" ${cur_% .* } ."
2872- cur_=" ${cur_##* .} "
2873- __gitcomp " insteadOf pushInsteadOf" " $pfx " " $cur_ " " $sfx "
2870+ cur_=" ${cur_#* .} "
2871+ local section=" ${pfx% .} "
2872+ __gitcomp_nl " $( __git config -f " $( __git rev-parse --show-toplevel) /.gitmodules" --get-regexp ' submodule.*.path' | awk -F. ' {print $2}' ) " " $pfx " " $cur_ " " ."
2873+ __git_compute_first_level_config_vars_for_section " ${section} "
2874+ local this_section=" __git_first_level_config_vars_for_section_${section} "
2875+ __gitcomp_nl_append " ${! this_section} " " $pfx " " $cur_ " " ${sfx:- } "
28742876 return
28752877 ;;
28762878 * .* )
0 commit comments