summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-09-11 21:53:13 -0700
committerJunio C Hamano <gitster@pobox.com>2011-09-11 21:53:13 -0700
commiteff7c32cfd12867000d6449d335fad0e7c9751f1 (patch)
tree392708c905f6d77ea5052dee5f1b76e7fe7f0a31 /config.c
parent7baf32a829e6e253f8b3b683da470be36b54c377 (diff)
parentf77bccaeba7a4c542e9b89d144af74bddd36fd08 (diff)
downloadgit-eff7c32cfd12867000d6449d335fad0e7c9751f1.tar.gz
Merge branch 'jk/maint-config-param' into maint
* 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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/config.c b/config.c
index 113723bf3b..49e5250dc5 100644
--- a/config.c
+++ b/config.c
@@ -42,10 +42,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]);
@@ -856,7 +856,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;