diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-07-19 09:45:21 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-07-19 09:45:21 -0700 |
commit | fe01ef31b79af85ca50738b11b048e3fad856d34 (patch) | |
tree | 0083d9d0b45381ff59856ba612f7f1b851a31a76 /config.c | |
parent | 20a80d04a4835dfec2823570719f17b6892e4841 (diff) | |
parent | f77bccaeba7a4c542e9b89d144af74bddd36fd08 (diff) | |
download | git-fe01ef31b79af85ca50738b11b048e3fad856d34.tar.gz |
Merge branch 'jk/maint-config-param'
* jk/maint-config-param:
config: use strbuf_split_str instead of a temporary strbuf
strbuf: allow strbuf_split to work on non-strbufs
config: avoid segfault when parsing command-line config
config: die on error in command-line config
fix "git -c" parsing of values with equals signs
strbuf_split: add a max parameter
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -50,10 +50,10 @@ void git_config_push_parameter(const char *text) static int git_config_parse_parameter(const char *text, config_fn_t fn, void *data) { - struct strbuf tmp = STRBUF_INIT; struct strbuf **pair; - strbuf_addstr(&tmp, text); - pair = strbuf_split(&tmp, '='); + pair = strbuf_split_str(text, '=', 2); + if (!pair[0]) + return error("bogus config parameter: %s", text); if (pair[0]->len && pair[0]->buf[pair[0]->len - 1] == '=') strbuf_setlen(pair[0], pair[0]->len - 1); strbuf_trim(pair[0]); @@ -874,7 +874,7 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config) switch (git_config_from_parameters(fn, data)) { case -1: /* error */ - ret--; + die("unable to parse command-line config"); break; case 0: /* found nothing */ break; |