diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-03-11 14:33:10 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-03-11 14:49:19 +0100 |
commit | 2bd131ba74802f67ce8e9e726b440e12a0b63929 (patch) | |
tree | 7d5933985f04b69a1b99fec116527ee1904801ca /tests/repo/config.c | |
parent | 2c9c8cdc100bc2e7fdb69eb9d4ad4312cffc460e (diff) | |
download | libgit2-cmn/config-ignore-access.tar.gz |
repository: allow the global and system configs to fail loadingcmn/config-ignore-access
Common misconfigurations on the server side means that $HOME may point
to the privileged use the application was running as before it dropped
privileges. Similarly, the system config file may not always be
readable.
Allow for reading both of these configurations to fail. This fixes #2122.
Diffstat (limited to 'tests/repo/config.c')
-rw-r--r-- | tests/repo/config.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/repo/config.c b/tests/repo/config.c index 2e7be37aa..c0597b92c 100644 --- a/tests/repo/config.c +++ b/tests/repo/config.c @@ -51,6 +51,25 @@ void test_repo_config__open_missing_global(void) git_sysdir_global_shutdown(); } +void test_repo_config__inaccessible_global(void) +{ + git_repository *repo; + + cl_git_pass(git_libgit2_opts( + GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr)); + cl_git_pass(git_libgit2_opts( + GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_SYSTEM, path.ptr)); + cl_git_pass(git_libgit2_opts( + GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_XDG, path.ptr)); + + cl_must_pass(p_chmod(path.ptr, 0000)); + + cl_git_pass(git_repository_open(&repo, "empty_standard_repo")); + git_repository_free(repo); + + cl_must_pass(p_chmod(path.ptr, 0777)); +} + void test_repo_config__open_missing_global_with_separators(void) { git_repository *repo; |