Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ. David Ibáñez <jdavid.ibp@gmail.com>2013-07-07 01:51:40 +0400
committerRussell Belfer <rb@github.com>2013-07-10 03:23:46 +0400
commit07fba63e9eda509d1eee13df0b325dbd4be2f3cd (patch)
treece211732a09a4339f734540c9c65248925fd6c56 /src/config.c
parent3eae9467e59241f5af6218ca079f96273fe1bc57 (diff)
Fix return value in git_config_get_multivar
If there is not an error, the return value was always the return value of the last call to file->get_multivar With this commit GIT_ENOTFOUND is only returned if all the calls to filge-get_multivar return GIT_ENOTFOUND.
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/config.c b/src/config.c
index 068c40260..aaad7d87c 100644
--- a/src/config.c
+++ b/src/config.c
@@ -535,6 +535,7 @@ int git_config_get_multivar(
file_internal *internal;
git_config_backend *file;
int ret = GIT_ENOTFOUND;
+ int err;
size_t i;
/*
@@ -547,9 +548,15 @@ int git_config_get_multivar(
continue;
file = internal->file;
- ret = file->get_multivar(file, name, regexp, cb, payload);
- if (ret < 0 && ret != GIT_ENOTFOUND)
- return ret;
+ err = file->get_multivar(file, name, regexp, cb, payload);
+ switch (err) {
+ case GIT_OK:
+ ret = GIT_OK;
+ case GIT_ENOTFOUND:
+ break;
+ default:
+ return err;
+ }
}
return (ret == GIT_ENOTFOUND) ? config_error_notfound(name) : 0;