mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-07 21:56:44 +00:00
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.
This commit is contained in:
parent
3eae9467e5
commit
07fba63e9e
13
src/config.c
13
src/config.c
@ -535,6 +535,7 @@ int git_config_get_multivar(
|
|||||||
file_internal *internal;
|
file_internal *internal;
|
||||||
git_config_backend *file;
|
git_config_backend *file;
|
||||||
int ret = GIT_ENOTFOUND;
|
int ret = GIT_ENOTFOUND;
|
||||||
|
int err;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -547,9 +548,15 @@ int git_config_get_multivar(
|
|||||||
continue;
|
continue;
|
||||||
file = internal->file;
|
file = internal->file;
|
||||||
|
|
||||||
ret = file->get_multivar(file, name, regexp, cb, payload);
|
err = file->get_multivar(file, name, regexp, cb, payload);
|
||||||
if (ret < 0 && ret != GIT_ENOTFOUND)
|
switch (err) {
|
||||||
return ret;
|
case GIT_OK:
|
||||||
|
ret = GIT_OK;
|
||||||
|
case GIT_ENOTFOUND:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ret == GIT_ENOTFOUND) ? config_error_notfound(name) : 0;
|
return (ret == GIT_ENOTFOUND) ? config_error_notfound(name) : 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user