summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-06-10 11:49:17 +0100
committerGitHub <noreply@github.com>2019-06-10 11:49:17 +0100
commitdd47a3ef7d131a96b3d6513c54d3cd9c73378124 (patch)
treea2085d2644cb3b84d4d8b48e337f73dae61142e9
parente50d138e898dd034161663873f75716086266f86 (diff)
parentcb28df20d8e1377d15fde8fcf08d15e907bbe3ef (diff)
downloadlibgit2-dd47a3ef7d131a96b3d6513c54d3cd9c73378124.tar.gz
Merge pull request #5099 from pks-t/pks/tests-fix-symlink-outside-sandbox
tests: checkout: fix symlink.git being created outside of sandbox
-rw-r--r--tests/checkout/index.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/checkout/index.c b/tests/checkout/index.c
index 8272c68b3..9aa41cc81 100644
--- a/tests/checkout/index.c
+++ b/tests/checkout/index.c
@@ -148,13 +148,15 @@ void test_checkout_index__honor_coreautocrlf_setting_set_to_true(void)
static void populate_symlink_workdir(void)
{
+ git_buf path = GIT_BUF_INIT;
git_repository *repo;
git_remote *origin;
git_object *target;
const char *url = git_repository_path(g_repo);
- cl_git_pass(git_repository_init(&repo, "../symlink.git", true));
+ cl_git_pass(git_buf_joinpath(&path, clar_sandbox_path(), "symlink.git"));
+ cl_git_pass(git_repository_init(&repo, path.ptr, true));
cl_git_pass(git_repository_set_workdir(repo, "symlink", 1));
/* Delete the `origin` repo (if it exists) so we can recreate it. */
@@ -166,8 +168,10 @@ static void populate_symlink_workdir(void)
cl_git_pass(git_revparse_single(&target, repo, "remotes/origin/master"));
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL));
+
git_object_free(target);
git_repository_free(repo);
+ git_buf_dispose(&path);
}
void test_checkout_index__honor_coresymlinks_default_true(void)