X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=repo-config.c;h=743f02b7de7b3b819d3db29ddfcdcf8ebacaccc4;hb=f252281102514d8d3cc15a3df5ae633619c93835;hp=03f108fe2f8a624075e7e7db4177df13dc38372f;hpb=474bc4e274322606fb9fd0f6edffb9ac7fd4a7a9;p=git.git diff --git a/repo-config.c b/repo-config.c index 03f108fe2..743f02b7d 100644 --- a/repo-config.c +++ b/repo-config.c @@ -29,16 +29,13 @@ static int show_config(const char* key_, const char* value_) const char *vptr = value; int dup_error = 0; - if (value_ == NULL) - value_ = ""; - if (!use_key_regexp && strcmp(key_, key)) return 0; if (use_key_regexp && regexec(key_regexp, key_, 0, NULL, 0)) return 0; if (regexp != NULL && (do_not_match ^ - regexec(regexp, value_, 0, NULL, 0))) + regexec(regexp, (value_?value_:""), 0, NULL, 0))) return 0; if (show_keys) @@ -46,11 +43,11 @@ static int show_config(const char* key_, const char* value_) if (seen && !do_all) dup_error = 1; if (type == T_INT) - sprintf(value, "%d", git_config_int(key_, value_)); + sprintf(value, "%d", git_config_int(key_, value_?value_:"")); else if (type == T_BOOL) vptr = git_config_bool(key_, value_) ? "true" : "false"; else - vptr = value_; + vptr = value_?value_:""; seen++; if (dup_error) { error("More than one value for the key %s: %s", @@ -74,8 +71,6 @@ static int get_value(const char* key_, const char* regex_) const char *home = getenv("HOME"); local = getenv("GIT_CONFIG_LOCAL"); if (!local) - local = repo_config; - else local = repo_config = strdup(git_path("config")); if (home) global = strdup(mkpath("%s/.gitconfig", home));