Skip to content

Commit dd47a3e

Browse files
authored
Merge pull request libgit2#5099 from pks-t/pks/tests-fix-symlink-outside-sandbox
tests: checkout: fix symlink.git being created outside of sandbox
2 parents e50d138 + cb28df2 commit dd47a3e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/checkout/index.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,15 @@ void test_checkout_index__honor_coreautocrlf_setting_set_to_true(void)
148148

149149
static void populate_symlink_workdir(void)
150150
{
151+
git_buf path = GIT_BUF_INIT;
151152
git_repository *repo;
152153
git_remote *origin;
153154
git_object *target;
154155

155156
const char *url = git_repository_path(g_repo);
156157

157-
cl_git_pass(git_repository_init(&repo, "../symlink.git", true));
158+
cl_git_pass(git_buf_joinpath(&path, clar_sandbox_path(), "symlink.git"));
159+
cl_git_pass(git_repository_init(&repo, path.ptr, true));
158160
cl_git_pass(git_repository_set_workdir(repo, "symlink", 1));
159161

160162
/* Delete the `origin` repo (if it exists) so we can recreate it. */
@@ -166,8 +168,10 @@ static void populate_symlink_workdir(void)
166168

167169
cl_git_pass(git_revparse_single(&target, repo, "remotes/origin/master"));
168170
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL));
171+
169172
git_object_free(target);
170173
git_repository_free(repo);
174+
git_buf_dispose(&path);
171175
}
172176

173177
void test_checkout_index__honor_coresymlinks_default_true(void)

0 commit comments

Comments
 (0)