Skip to content

Commit ed812ee

Browse files
committed
config::include: sanitize homedir
Sanitize the home directory to ensure that we do not accidentally locate a file called `~/.nonexistentfile`.
1 parent 29aef94 commit ed812ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/config/include.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ void test_config_include__missing_homedir(void)
113113
git_config *cfg;
114114
git_buf buf = GIT_BUF_INIT;
115115

116+
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, cl_fixture("config")));
116117
cl_git_mkfile("including", "[include]\npath = ~/.nonexistentfile\n[foo]\nbar = baz");
117118

118119
giterr_clear();
@@ -123,6 +124,8 @@ void test_config_include__missing_homedir(void)
123124

124125
git_buf_free(&buf);
125126
git_config_free(cfg);
127+
128+
cl_sandbox_set_search_path_defaults();
126129
}
127130

128131
#define replicate10(s) s s s s s s s s s s

0 commit comments

Comments
 (0)