summaryrefslogtreecommitdiff
path: root/tests/t12-repo.c
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2011-03-15 22:07:01 +0100
committerVicent Marti <tanoku@gmail.com>2011-03-23 00:17:24 +0200
commit677a3c07f47f46dcbab4a3ee8a1e2aace6f999b0 (patch)
tree9e638926a6d72f963d5102b676d574702b8d36c3 /tests/t12-repo.c
parentae6ba7f713804e1c04febee81a8f52ea0abf443b (diff)
downloadlibgit2-677a3c07f47f46dcbab4a3ee8a1e2aace6f999b0.tar.gz
Add failing test for issue 84
see https://github.com/libgit2/libgit2/issues#issue/84
Diffstat (limited to 'tests/t12-repo.c')
-rw-r--r--tests/t12-repo.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/t12-repo.c b/tests/t12-repo.c
index a9a93d147..8b39e3902 100644
--- a/tests/t12-repo.c
+++ b/tests/t12-repo.c
@@ -162,11 +162,33 @@ BEGIN_TEST(init1, "initialize a bare repo")
must_pass(ensure_repository_init(TEMP_REPO_FOLDER_NS, BARE_REPOSITORY, NULL, path_repository, NULL));
END_TEST
+BEGIN_TEST(init2, "Initialize a bare repo with a relative path escaping out of the current working directory")
+ char path_repository[GIT_PATH_MAX];
+ char current_workdir[GIT_PATH_MAX];
+ const int mode = 0755; /* or 0777 ? */
+ git_repository* repo;
+
+ must_pass(gitfo_getcwd(current_workdir, sizeof(current_workdir)));
+
+ git__joinpath(path_repository, current_workdir, "a/b/c/");
+ must_pass(gitfo_mkdir_recurs(path_repository, mode));
+
+ must_pass(chdir(path_repository));
+
+ must_pass(git_repository_init(&repo, "../d/e.git", 1));
+ git_repository_free(repo);
+
+ must_pass(chdir(current_workdir));
+
+ git__joinpath(path_repository, current_workdir, "a/");
+ must_pass(rmdir_recurs(path_repository));
+END_TEST
BEGIN_SUITE(repository)
ADD_TEST(odb0);
ADD_TEST(odb1);
ADD_TEST(init0);
ADD_TEST(init1);
+ ADD_TEST(init2);
END_SUITE