fix "git -c" parsing of values with equals signs
If you do something like: git -c core.foo="value with = in it" ... we would split your option on "=" into three fields and throw away the third one. With this patch we correctly take everything after the first "=" as the value (keys cannot have an equals sign in them, so the parsing is unambiguous). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
28fc3a6857
commit
5bf6529aaa
2
config.c
2
config.c
@ -45,7 +45,7 @@ static int git_config_parse_parameter(const char *text,
|
||||
struct strbuf tmp = STRBUF_INIT;
|
||||
struct strbuf **pair;
|
||||
strbuf_addstr(&tmp, text);
|
||||
pair = strbuf_split(&tmp, '=');
|
||||
pair = strbuf_split_max(&tmp, '=', 2);
|
||||
if (pair[0]->len && pair[0]->buf[pair[0]->len - 1] == '=')
|
||||
strbuf_setlen(pair[0], pair[0]->len - 1);
|
||||
strbuf_trim(pair[0]);
|
||||
|
Reference in New Issue
Block a user