]> git.ipfire.org Git - thirdparty/git.git/commit - t/t1300-config.sh
config: use git_config_parse_key() in git_config_parse_parameter()
authorJunio C Hamano <gitster@pobox.com>
Thu, 23 Feb 2017 23:04:40 +0000 (15:04 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Feb 2017 06:03:03 +0000 (22:03 -0800)
commit1274a155af96fcbcf2e60ae9fc9ee8dbdbbe987a
tree3ad3cc57445fa68f74fd2c9d694fc6bf8b527190
parentee98df3fa41d83f037b96cb11dc72181816920c7
config: use git_config_parse_key() in git_config_parse_parameter()

The parsing of one-shot assignments of configuration variables that
come from the command line historically was quite loose and allowed
anything to pass.  It also downcased everything in the variable name,
even a three-level <section>.<subsection>.<variable> name in which
the <subsection> part must be treated in a case sensitive manner.

Existing git_config_parse_key() helper is used to parse the variable
name that comes from the command line, i.e. "git config VAR VAL",
and handles these details correctly.  Replace the strbuf_tolower()
call in git_config_parse_parameter() with a call to it to correct
both issues.  git_config_parse_key() does a bit more things that are
not necessary for the purpose of this codepath (e.g. it allocates a
separate buffer to return the canonicalized variable name because it
takes a "const char *" input), but we are not in a performance-critical
codepath here.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c
t/t1300-repo-config.sh