mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 11:06:32 +00:00
Merge pull request #6547 from libgit2/ethomson/programdata
config: return `GIT_ENOTFOUND` for missing programdata
This commit is contained in:
@@ -1174,9 +1174,12 @@ int git_config__find_programdata(git_str *path)
|
||||
GIT_FS_PATH_OWNER_CURRENT_USER |
|
||||
GIT_FS_PATH_OWNER_ADMINISTRATOR;
|
||||
bool is_safe;
|
||||
int error;
|
||||
|
||||
if (git_sysdir_find_programdata_file(path, GIT_CONFIG_FILENAME_PROGRAMDATA) < 0 ||
|
||||
git_fs_path_owner_is(&is_safe, path->ptr, owner_level) < 0)
|
||||
if ((error = git_sysdir_find_programdata_file(path, GIT_CONFIG_FILENAME_PROGRAMDATA)) < 0)
|
||||
return error;
|
||||
|
||||
if (git_fs_path_owner_is(&is_safe, path->ptr, owner_level) < 0)
|
||||
return -1;
|
||||
|
||||
if (!is_safe) {
|
||||
|
||||
11
tests/libgit2/config/find.c
Normal file
11
tests/libgit2/config/find.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "clar_libgit2.h"
|
||||
|
||||
void test_config_find__one(void)
|
||||
{
|
||||
git_buf buf = GIT_BUF_INIT;
|
||||
|
||||
cl_git_fail_with(GIT_ENOTFOUND, git_config_find_global(&buf));
|
||||
cl_git_fail_with(GIT_ENOTFOUND, git_config_find_xdg(&buf));
|
||||
cl_git_fail_with(GIT_ENOTFOUND, git_config_find_system(&buf));
|
||||
cl_git_fail_with(GIT_ENOTFOUND, git_config_find_programdata(&buf));
|
||||
}
|
||||
Reference in New Issue
Block a user