Code

Merge branch 'jk/maint-config-param' into maint
[git.git] / config.c
index 113723bf3b069ed907cd71831ddff91a0ed113da..49e5250dc5384a012dc828d156cbf8686db9d0bb 100644 (file)
--- 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;