X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=config.c;h=08e47e2e48a5bd310025752ee5ecdce81721b34d;hb=52de6fa2c7ac26a67027e715d45771cb908eb77c;hp=71ef171cab78bfdb9d6421f2a2b84acbce0bfc00;hpb=67117596173cc49b0ca4b8b5739c5fd794a7022a;p=git.git diff --git a/config.c b/config.c index 71ef171ca..08e47e2e4 100644 --- a/config.c +++ b/config.c @@ -60,7 +60,7 @@ static int handle_path_include(const char *path, struct config_include_data *inc path = buf.buf; } - if (!access(path, R_OK)) { + if (!access_or_warn(path, R_OK)) { if (++inc->depth > MAX_INCLUDE_DEPTH) die(include_depth_advice, MAX_INCLUDE_DEPTH, path, cf && cf->name ? cf->name : "the command line"); @@ -758,6 +758,11 @@ static int git_default_core_config(const char *var, const char *value) return 0; } + if (!strcmp(var, "core.precomposeunicode")) { + precomposed_unicode = git_config_bool(var, value); + return 0; + } + /* Add other config variables here and to Documentation/config.txt. */ return 0; } @@ -929,25 +934,28 @@ int git_config_system(void) int git_config_early(config_fn_t fn, void *data, const char *repo_config) { int ret = 0, found = 0; - const char *home = NULL; + char *xdg_config = NULL; + char *user_config = NULL; - if (git_config_system() && !access(git_etc_gitconfig(), R_OK)) { + home_config_paths(&user_config, &xdg_config, "config"); + + if (git_config_system() && !access_or_warn(git_etc_gitconfig(), R_OK)) { ret += git_config_from_file(fn, git_etc_gitconfig(), data); found += 1; } - home = getenv("HOME"); - if (home) { - char buf[PATH_MAX]; - char *user_config = mksnpath(buf, sizeof(buf), "%s/.gitconfig", home); - if (!access(user_config, R_OK)) { - ret += git_config_from_file(fn, user_config, data); - found += 1; - } + if (xdg_config && !access_or_warn(xdg_config, R_OK)) { + ret += git_config_from_file(fn, xdg_config, data); + found += 1; + } + + if (user_config && !access_or_warn(user_config, R_OK)) { + ret += git_config_from_file(fn, user_config, data); + found += 1; } - if (repo_config && !access(repo_config, R_OK)) { + if (repo_config && !access_or_warn(repo_config, R_OK)) { ret += git_config_from_file(fn, repo_config, data); found += 1; } @@ -963,6 +971,8 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config) break; } + free(xdg_config); + free(user_config); return ret == 0 ? found : ret; }