Browse Source

completion: support case-insensitive config vars

Config variables are case-insensitive but this case/esac construct is
case-sensitive by default. For bash v4, it'll be easy. For platforms
that are stuck with older versions, we need an external command, but
that is not that critical. And where this additional overhead matters
the most is Windows, but luckily Git for Windows ships with Bash v4.

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Nguyễn Thái Ngọc Duy 7 years ago committed by Junio C Hamano
parent
commit
bea2125928
  1. 10
      contrib/completion/git-completion.bash

10
contrib/completion/git-completion.bash

@ -1995,7 +1995,15 @@ __git_compute_config_vars () @@ -1995,7 +1995,15 @@ __git_compute_config_vars ()

_git_config ()
{
case "$prev" in
local varname

if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then
varname="${prev,,}"
else
varname="$(echo "$prev" |tr A-Z a-z)"
fi

case "$varname" in
branch.*.remote|branch.*.pushremote)
__gitcomp_nl "$(__git_remotes)"
return

Loading…
Cancel
Save