summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-06-09 11:51:36 -0400
committerJunio C Hamano <gitster@pobox.com>2011-06-22 11:24:50 -0700
commit5bf6529aaa3fa829328ae00ddf7aa851935443b5 (patch)
tree384f4778f9e741969ac8661c2728f67045a94c6f /config.c
parent28fc3a6857a5d7a6b4f63b2672fb0ce966b0df78 (diff)
downloadgit-5bf6529aaa3fa829328ae00ddf7aa851935443b5.tar.gz
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>
Diffstat (limited to 'config.c')
-rw-r--r--config.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/config.c b/config.c
index 61de4d6a17..84ff346859 100644
--- a/config.c
+++ b/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]);