summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill@shutemov.name>2014-02-19 00:58:54 +0200
committerJunio C Hamano <gitster@pobox.com>2014-02-18 16:12:13 -0800
commitc8985ce05360857733738561dd6cdf964470cbdf (patch)
tree3435c93484d5e89639c41d2e9a101282f4ab71be /config.c
parent6aea9f0fdd2f013e9b63137727c73da02d42a1be (diff)
downloadgit-c8985ce05360857733738561dd6cdf964470cbdf.tar.gz
config: change git_config_with_options() interface
We're going to have more options for config source. Let's alter git_config_with_options() interface to accept struct with all source options. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/config.c b/config.c
index b295310d3c..a21b0ddade 100644
--- a/config.c
+++ b/config.c
@@ -1172,8 +1172,7 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)
}
int git_config_with_options(config_fn_t fn, void *data,
- const char *filename,
- const char *blob_ref,
+ struct git_config_source *config_source,
int respect_includes)
{
char *repo_config = NULL;
@@ -1191,10 +1190,10 @@ int git_config_with_options(config_fn_t fn, void *data,
* If we have a specific filename, use it. Otherwise, follow the
* regular lookup sequence.
*/
- if (filename)
- return git_config_from_file(fn, filename, data);
- else if (blob_ref)
- return git_config_from_blob_ref(fn, blob_ref, data);
+ if (config_source && config_source->file)
+ return git_config_from_file(fn, config_source->file, data);
+ else if (config_source && config_source->blob)
+ return git_config_from_blob_ref(fn, config_source->blob, data);
repo_config = git_pathdup("config");
ret = git_config_early(fn, data, repo_config);
@@ -1205,7 +1204,7 @@ int git_config_with_options(config_fn_t fn, void *data,
int git_config(config_fn_t fn, void *data)
{
- return git_config_with_options(fn, data, NULL, NULL, 1);
+ return git_config_with_options(fn, data, NULL, 1);
}
/*