summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 80d868b)
raw | patch | inline | side by side (parent: 80d868b)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Fri, 26 Nov 2010 15:32:33 +0000 (22:32 +0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 22 Dec 2010 22:34:24 +0000 (14:34 -0800) |
This version of git_config() will be used during repository setup.
As a repository is being set up, $GIT_DIR is not nailed down yet,
git_pathdup() should not be used to get $GIT_DIR/config.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
As a repository is being set up, $GIT_DIR is not nailed down yet,
git_pathdup() should not be used to get $GIT_DIR/config.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h | patch | blob | history | |
config.c | patch | blob | history |
index d1bee5d5186c4f1369d66c14a5ad49c5e36f7bf8..123dd4bb93ebfd387a79bd6a4ccf012257a8b0b0 100644 (file)
--- a/cache.h
+++ b/cache.h
extern int git_config_parse_environment(void);
extern int git_config_from_parameters(config_fn_t fn, void *data);
extern int git_config(config_fn_t fn, void *);
+extern int git_config_early(config_fn_t fn, void *, const char *repo_config);
extern int git_parse_ulong(const char *, unsigned long *);
extern int git_config_int(const char *, const char *);
extern unsigned long git_config_ulong(const char *, const char *);
diff --git a/config.c b/config.c
index 4b0a82040e7982ab936ed52b2bb3405bc85b80f8..c431f41c5a0d0645a53242e046350ff95a8b48f5 100644 (file)
--- a/config.c
+++ b/config.c
return 0;
}
-int git_config(config_fn_t fn, void *data)
+int git_config_early(config_fn_t fn, void *data, const char *repo_config)
{
int ret = 0, found = 0;
- char *repo_config = NULL;
const char *home = NULL;
/* Setting $GIT_CONFIG makes git read _only_ the given config file. */
free(user_config);
}
- repo_config = git_pathdup("config");
- if (!access(repo_config, R_OK)) {
+ if (repo_config && !access(repo_config, R_OK)) {
ret += git_config_from_file(fn, repo_config, data);
found += 1;
}
- free(repo_config);
ret += git_config_from_parameters(fn, data);
if (config_parameters)
return ret;
}
+int git_config(config_fn_t fn, void *data)
+{
+ char *repo_config = NULL;
+ int ret;
+
+ repo_config = git_pathdup("config");
+ ret = git_config_early(fn, data, repo_config);
+ if (repo_config)
+ free(repo_config);
+ return ret;
+}
+
/*
* Find all the stuff for git_config_set() below.
*/