summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-11-17 08:38:46 -0500
committerEdward Thomson <ethomson@microsoft.com>2015-11-17 08:46:21 -0500
commit6f7c411834be0ccd5047f58d39daee1f6ec2edc3 (patch)
tree6c998e4a5100cc4618c29a0a4c89fd2977f9d677
parent3eac1037d68a355f77787d7c8e496694715dd28c (diff)
downloadlibgit2-6f7c411834be0ccd5047f58d39daee1f6ec2edc3.tar.gz
config::global: use PROGRAMDATA configuration
Query the `GIT_CONFIG_LEVEL_PROGRAMDATA` location when setting it up for tests, in case the test runner has sandboxed it.
-rw-r--r--tests/config/global.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/config/global.c b/tests/config/global.c
index 1336ef6e7..0ddd204ad 100644
--- a/tests/config/global.c
+++ b/tests/config/global.c
@@ -68,7 +68,6 @@ void test_config_global__open_xdg(void)
void test_config_global__open_programdata(void)
{
- char *programdata;
git_config *cfg;
git_repository *repo;
git_buf config_path = GIT_BUF_INIT;
@@ -77,9 +76,12 @@ void test_config_global__open_programdata(void)
if (!cl_getenv("GITTEST_INVASIVE_FS_STRUCTURE"))
cl_skip();
- programdata = cl_getenv("PROGRAMDATA");
- cl_git_pass(git_buf_printf(&config_path, "%s/Git", programdata));
- cl_git_pass(p_mkdir(config_path.ptr, 0777));
+ cl_git_pass(git_libgit2_opts(GIT_OPT_GET_SEARCH_PATH,
+ GIT_CONFIG_LEVEL_PROGRAMDATA, &config_path));
+
+ if (!git_path_isdir(config_path.ptr))
+ cl_git_pass(p_mkdir(config_path.ptr, 0777));
+
cl_git_pass(git_buf_puts(&config_path, "/config"));
cl_git_pass(git_config_open_ondisk(&cfg, config_path.ptr));