Code

Introduce git_etc_gitconfig() that encapsulates access of ETC_GITCONFIG.
[git.git] / config.c
index dd2de6e38e8d68d8622ad542e5c73cbcffeceeac..cee2d26d0ce19a085fd5de275f8b295b0865c9a6 100644 (file)
--- a/config.c
+++ b/config.c
@@ -426,6 +426,18 @@ int git_default_config(const char *var, const char *value)
                return 0;
        }
 
+       if (!strcmp(var, "core.editor")) {
+               editor_program = xstrdup(value);
+               return 0;
+       }
+
+       if (!strcmp(var, "core.excludesfile")) {
+               if (!value)
+                       die("core.excludesfile without value");
+               excludes_file = xstrdup(value);
+               return 0;
+       }
+
        /* Add other config variables here and to Documentation/config.txt. */
        return 0;
 }
@@ -447,6 +459,11 @@ int git_config_from_file(config_fn_t fn, const char *filename)
        return ret;
 }
 
+const char *git_etc_gitconfig(void)
+{
+       return ETC_GITCONFIG;
+}
+
 int git_config(config_fn_t fn)
 {
        int ret = 0;
@@ -459,8 +476,8 @@ int git_config(config_fn_t fn)
         * config file otherwise. */
        filename = getenv(CONFIG_ENVIRONMENT);
        if (!filename) {
-               if (!access(ETC_GITCONFIG, R_OK))
-                       ret += git_config_from_file(fn, ETC_GITCONFIG);
+               if (!access(git_etc_gitconfig(), R_OK))
+                       ret += git_config_from_file(fn, git_etc_gitconfig());
                home = getenv("HOME");
                filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
                if (!filename)