Commit ed812ee7 by Edward Thomson

config::include: sanitize homedir

Sanitize the home directory to ensure that we do not accidentally locate
a file called `~/.nonexistentfile`.
parent 29aef948
...@@ -113,6 +113,7 @@ void test_config_include__missing_homedir(void) ...@@ -113,6 +113,7 @@ void test_config_include__missing_homedir(void)
git_config *cfg; git_config *cfg;
git_buf buf = GIT_BUF_INIT; git_buf buf = GIT_BUF_INIT;
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, cl_fixture("config")));
cl_git_mkfile("including", "[include]\npath = ~/.nonexistentfile\n[foo]\nbar = baz"); cl_git_mkfile("including", "[include]\npath = ~/.nonexistentfile\n[foo]\nbar = baz");
giterr_clear(); giterr_clear();
...@@ -123,6 +124,8 @@ void test_config_include__missing_homedir(void) ...@@ -123,6 +124,8 @@ void test_config_include__missing_homedir(void)
git_buf_free(&buf); git_buf_free(&buf);
git_config_free(cfg); git_config_free(cfg);
cl_sandbox_set_search_path_defaults();
} }
#define replicate10(s) s s s s s s s s s s #define replicate10(s) s s s s s s s s s s
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment