summaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/config.c b/src/config.c
index 29b9b799f..39a236ad9 100644
--- a/src/config.c
+++ b/src/config.c
@@ -310,13 +310,19 @@ int git_config_get_string(git_config *cfg, const char *name, const char **out)
{
file_internal *internal;
git_config_file *file;
+ int i, error;
if (cfg->files.length == 0)
return git__throw(GIT_EINVALIDARGS, "Cannot get variable value; no files open in the `git_config` instance");
- internal = git_vector_get(&cfg->files, 0);
- file = internal->file;
+ for (i = 0; i < cfg->files.length; ++i) {
+ internal = git_vector_get(&cfg->files, i);
+ file = internal->file;
+ error = file->get(file, name, out);
+ if (error == GIT_SUCCESS)
+ break;
+ }
- return file->get(file, name, out);
+ return error;
}