summaryrefslogtreecommitdiff
path: root/tests/clar_libgit2.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-05-01 14:47:33 -0700
committerRussell Belfer <rb@github.com>2014-05-02 09:21:33 -0700
commit0f603132bc2397bf8308e72651c56cb7dbd3ad70 (patch)
tree0ea052ae8023fc0929e8af5e08422bd336b946e1 /tests/clar_libgit2.h
parentbc91347b5894c98964a12c6637d5ca91d9723b42 (diff)
downloadlibgit2-0f603132bc2397bf8308e72651c56cb7dbd3ad70.tar.gz
Improve handling of fake home directory
There are a few tests that set up a fake home directory and a fake GLOBAL search path so that we can test things in global ignore or attribute or config files. This cleans up that code to work more robustly even if there is a test failure. This also fixes some valgrind warnings where scanning search paths for separators could end up doing a little bit of sketchy data access when coming to the end of search list.
Diffstat (limited to 'tests/clar_libgit2.h')
-rw-r--r--tests/clar_libgit2.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/clar_libgit2.h b/tests/clar_libgit2.h
index 082fa9f4a..f84d9e353 100644
--- a/tests/clar_libgit2.h
+++ b/tests/clar_libgit2.h
@@ -131,7 +131,12 @@ int cl_repo_get_bool(git_repository *repo, const char *cfg);
void cl_repo_set_string(git_repository *repo, const char *cfg, const char *value);
-void cl_fake_home(git_buf *restore);
-void cl_fake_home_cleanup(git_buf *restore);
+/* set up a fake "home" directory and set libgit2 GLOBAL search path.
+ *
+ * automatically configures cleanup function to restore the regular search
+ * path, although you can call it explicitly if you wish (with NULL).
+ */
+void cl_fake_home(void);
+void cl_fake_home_cleanup(void *);
#endif