X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=config.c;h=e42c59b190986d28ec535861e08b843739356b9a;hb=1acf11717f01b542e099544796f00df567a66e90;hp=1fc063b2562101687b9215e5b697a91fcffdd5bb;hpb=eb4f4076aa89d38221ee513a5f28f22124029c90;p=git.git diff --git a/config.c b/config.c index 1fc063b25..e42c59b19 100644 --- a/config.c +++ b/config.c @@ -47,13 +47,13 @@ void git_config_push_parameter(const char *text) strbuf_release(&env); } -static int git_config_parse_parameter(const char *text, - config_fn_t fn, void *data) +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; @@ -1499,10 +1499,10 @@ int git_config_rename_section(const char *old_name, const char *new_name) } } fclose(config_file); - unlock_and_out: +unlock_and_out: if (commit_lock_file(lock) < 0) ret = error("could not commit config file %s", config_filename); - out: +out: free(config_filename); return ret; }