summaryrefslogtreecommitdiff
path: root/tests/libgit2/repo/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libgit2/repo/env.c')
-rw-r--r--tests/libgit2/repo/env.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/libgit2/repo/env.c b/tests/libgit2/repo/env.c
index 790ffd40f..5f084ac00 100644
--- a/tests/libgit2/repo/env.c
+++ b/tests/libgit2/repo/env.c
@@ -31,6 +31,8 @@ void test_repo_env__cleanup(void)
if (git_fs_path_isdir("peeled.git"))
git_futils_rmdir_r("peeled.git", NULL, GIT_RMDIR_REMOVE_FILES);
+ cl_fixture_cleanup("test_workdir");
+
clear_git_env();
}
@@ -275,3 +277,21 @@ void test_repo_env__open(void)
clear_git_env();
}
+
+void test_repo_env__work_tree(void)
+{
+ git_repository *repo;
+ const char *test_path;
+
+ cl_fixture_sandbox("attr");
+ cl_git_pass(p_rename("attr/.gitted", "attr/.git"));
+
+ cl_must_pass(p_mkdir("test_workdir", 0777));
+ test_path = cl_git_sandbox_path(1, "test_workdir", NULL);
+
+ cl_setenv("GIT_WORK_TREE", test_path);
+ cl_git_pass(git_repository_open_ext(&repo, "attr", GIT_REPOSITORY_OPEN_FROM_ENV, NULL));
+ cl_assert_equal_s(test_path, git_repository_workdir(repo));
+ git_repository_free(repo);
+ cl_setenv("GIT_WORK_TREE", NULL);
+}