completion: complete general config vars in two steps

There are 581 config variables as of now when you do "git config <tab>" which can fill up a few screens and is not very helpful when you have to look through columns of text to find what you want. This patch instead shows you only first level when you do git config <tab> There are 78 items, which use up 8 rows in my screen. Compared to screens of text, it's pretty good. Once you have chosen you first level, e.g. color: git config color.<tab> will show you all color.* This is not a new idea. branch.* and remote.* completion already does this for second and third levels. For those variables, you'll need to <tab> three times to get full variable name. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed May 27, 2018 at 20:28 UTC f22f682695d8f1bf79cde44cfe0b913905c1ef9a
1 file changed +7 -2
contrib/completion/git-completion.bash
+7 -2
@@ -2158,9 +2158,14 @@ _git_config ()
2158 __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_"
2159 return
2160 ;;
2161 + *.*)
2162 + __git_compute_config_vars
2163 + __gitcomp "$__git_config_vars"
2164 + ;;
2165 + *)
2166 + __git_compute_config_vars
2167 + __gitcomp "$(echo "$__git_config_vars" | sed 's/\.[^ ]*/./g')"
2168 esac
2162 - __git_compute_config_vars
2163 - __gitcomp "$__git_config_vars"
2169 }
2170
2171 _git_remote ()