summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-05-26 13:55:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-29 05:51:29 (GMT)
commitbea2125928f4d6ddad34c6e651d4a9ec7ee5dd4e (patch)
tree01fb926309aba70ea6f561dce00af172130a9ec2 /contrib
parentf45db831c17d0a32d2e1cd0f5ac40708020bcf8f (diff)
downloadgit-bea2125928f4d6ddad34c6e651d4a9ec7ee5dd4e.zip
git-bea2125928f4d6ddad34c6e651d4a9ec7ee5dd4e.tar.gz
git-bea2125928f4d6ddad34c6e651d4a9ec7ee5dd4e.tar.bz2
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>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-completion.bash10
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index e74d50a..97776fb 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -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