[PATCH 5/6] Allow Specification of the conf file to read for git_config operations
- From
- Martin Atukunda <matlads@dsmagic.com>
- Date
- Nov 22, 2005, 00:28 UTC
- Message-ID
- <11326192933767-git-send-email-matlads@dsmagic.com>
- In-Reply-To
- <11326192921291-git-send-email-matlads@dsmagic.com>
This patch adds a git_config_from_file which allows us to specify the config file to use for git_config operations.
Signed-Off-By: Martin Atukunda <matlads@dsmagic.com>
---
cache.h | 1 + config.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-)
applies-to: d6c3faa0566795b1c74e693ecc004439c116e6c6 39e4ab307abb445115f3c9ee0e09ed1812568247
diff --git a/cache.h b/cache.h index a455373..48018ab 100644 --- a/cache.h +++ b/cache.h @@ -388,6 +388,7 @@ extern int gitfakemunmap(void *start, si typedef int (*config_fn_t)(const char *, const char *); extern int git_default_config(const char *, const char *); +extern int git_config_from_file(const char *, config_fn_t fn); extern int git_config(config_fn_t fn); extern int git_config_int(const char *, const char *); extern int git_config_bool(const char *, const char *); diff --git a/config.c b/config.c index 5d237c8..c5a5312 100644 --- a/config.c +++ b/config.c @@ -245,11 +245,10 @@ int git_default_config(const char *var, return 0; } -int git_config(config_fn_t fn) +int git_config_from_file(const char *confpath, config_fn_t fn) { int ret; - FILE *f = fopen(git_path("config"), "r"); - + FILE *f = fopen(confpath, "r"); ret = -1; if (f) { config_file = f; @@ -260,6 +259,11 @@ int git_config(config_fn_t fn) return ret; } +int git_config(config_fn_t fn) +{ + return git_config_from_file(git_path("config"), fn); +} + /* * Find all the stuff for git_config_set() below. */ --- 0.99.9.GIT