diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-11-17 11:22:01 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-11-17 11:22:01 -0500 |
commit | 88638f9b1841a83e82fc5f79bf00f90d40fb426f (patch) | |
tree | 23e9f7e47155e28610ab9ae1e51a683185af29cf /tests | |
parent | fe96374823b5f944622dfa3b91f460d4753bc935 (diff) | |
download | libgit2-88638f9b1841a83e82fc5f79bf00f90d40fb426f.tar.gz |
tests: use out-of-the-way config dir in sandbox
Don't put the configuration in a subdir of the sandbox named
`config`, lest some tests decide to create their own directory
called `config`. Prefix with some underscores for uniqueness.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/clar_libgit2.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/clar_libgit2.c b/tests/clar_libgit2.c index 1bf69c5d4..314d3441e 100644 --- a/tests/clar_libgit2.c +++ b/tests/clar_libgit2.c @@ -541,16 +541,23 @@ void cl_fake_home(void) void cl_sandbox_set_search_path_defaults(void) { - const char *sandbox_path = clar_sandbox_path(); + git_buf path = GIT_BUF_INIT; + + git_buf_joinpath(&path, clar_sandbox_path(), "__config"); + + if (!git_path_exists(path.ptr)) + cl_must_pass(p_mkdir(path.ptr, 0777)); git_libgit2_opts( - GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, sandbox_path); + GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr); git_libgit2_opts( - GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_XDG, sandbox_path); + GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_XDG, path.ptr); git_libgit2_opts( - GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_SYSTEM, sandbox_path); + GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_SYSTEM, path.ptr); git_libgit2_opts( - GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_PROGRAMDATA, sandbox_path); + GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_PROGRAMDATA, path.ptr); + + git_buf_free(&path); } #ifdef GIT_WIN32 |