summaryrefslogtreecommitdiff
path: root/tests/clar_libgit2.c
diff options
context:
space:
mode:
authorVicent Marti <vicent@github.com>2014-04-16 10:51:25 +0200
committerVicent Marti <vicent@github.com>2014-04-16 10:51:25 +0200
commit37ab5ecc107118d5fa541cb42cc203649e549fd8 (patch)
tree5908575b2522b553cad65adf69a78a9267170c2c /tests/clar_libgit2.c
parent0f7aa47dbd16a9111e5dd054014d2f61b9b21211 (diff)
parenta9528b8fdd627e11b9dee099a10fa7697380b3e7 (diff)
downloadlibgit2-37ab5ecc107118d5fa541cb42cc203649e549fd8.tar.gz
Merge pull request #2269 from libgit2/rb/fix-leading-slash-ignores
Fix core.excludesfile named .gitignore
Diffstat (limited to 'tests/clar_libgit2.c')
-rw-r--r--tests/clar_libgit2.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/clar_libgit2.c b/tests/clar_libgit2.c
index 9b062ef78..90e53c5e6 100644
--- a/tests/clar_libgit2.c
+++ b/tests/clar_libgit2.c
@@ -490,3 +490,24 @@ void clar__assert_equal_file(
clar__assert_equal(file, line, "mismatched file length", 1, "%"PRIuZ,
(size_t)expected_bytes, (size_t)total_bytes);
}
+
+void cl_fake_home(git_buf *restore)
+{
+ git_buf path = GIT_BUF_INIT;
+
+ cl_git_pass(git_libgit2_opts(
+ GIT_OPT_GET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, restore));
+
+ cl_must_pass(p_mkdir("home", 0777));
+ cl_git_pass(git_path_prettify(&path, "home", NULL));
+ cl_git_pass(git_libgit2_opts(
+ GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr));
+ git_buf_free(&path);
+}
+
+void cl_fake_home_cleanup(git_buf *restore)
+{
+ cl_git_pass(git_libgit2_opts(
+ GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, restore->ptr));
+ git_buf_free(restore);
+}