summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/blame/buffer.c4
-rw-r--r--tests/core/env.c33
-rw-r--r--tests/index/addall.c2
-rw-r--r--tests/repo/config.c9
-rw-r--r--tests/repo/iterator.c2
-rw-r--r--tests/repo/open.c3
-rw-r--r--tests/repo/shallow.c6
7 files changed, 34 insertions, 25 deletions
diff --git a/tests/blame/buffer.c b/tests/blame/buffer.c
index 912ee9846..340b1dced 100644
--- a/tests/blame/buffer.c
+++ b/tests/blame/buffer.c
@@ -1,7 +1,7 @@
#include "blame_helpers.h"
-git_repository *g_repo;
-git_blame *g_fileblame, *g_bufferblame;
+static git_repository *g_repo;
+static git_blame *g_fileblame, *g_bufferblame;
void test_blame_buffer__initialize(void)
{
diff --git a/tests/core/env.c b/tests/core/env.c
index 0fa6472d7..a32f5ed3e 100644
--- a/tests/core/env.c
+++ b/tests/core/env.c
@@ -1,5 +1,6 @@
#include "clar_libgit2.h"
#include "fileops.h"
+#include "sysdir.h"
#include "path.h"
#ifdef GIT_WIN32
@@ -41,12 +42,12 @@ void test_core_env__initialize(void)
static void reset_global_search_path(void)
{
- cl_git_pass(git_futils_dirs_set(GIT_FUTILS_DIR_GLOBAL, NULL));
+ cl_git_pass(git_sysdir_set(GIT_SYSDIR_GLOBAL, NULL));
}
static void reset_system_search_path(void)
{
- cl_git_pass(git_futils_dirs_set(GIT_FUTILS_DIR_SYSTEM, NULL));
+ cl_git_pass(git_sysdir_set(GIT_SYSDIR_SYSTEM, NULL));
}
void test_core_env__cleanup(void)
@@ -120,18 +121,18 @@ void test_core_env__0(void)
git_buf_rtruncate_at_char(&path, '/');
cl_assert_equal_i(
- GIT_ENOTFOUND, git_futils_find_global_file(&found, testfile));
+ GIT_ENOTFOUND, git_sysdir_find_global_file(&found, testfile));
setenv_and_check("HOME", path.ptr);
reset_global_search_path();
- cl_git_pass(git_futils_find_global_file(&found, testfile));
+ cl_git_pass(git_sysdir_find_global_file(&found, testfile));
cl_setenv("HOME", env_save[0]);
reset_global_search_path();
cl_assert_equal_i(
- GIT_ENOTFOUND, git_futils_find_global_file(&found, testfile));
+ GIT_ENOTFOUND, git_sysdir_find_global_file(&found, testfile));
#ifdef GIT_WIN32
setenv_and_check("HOMEDRIVE", NULL);
@@ -139,7 +140,7 @@ void test_core_env__0(void)
setenv_and_check("USERPROFILE", path.ptr);
reset_global_search_path();
- cl_git_pass(git_futils_find_global_file(&found, testfile));
+ cl_git_pass(git_sysdir_find_global_file(&found, testfile));
{
int root = git_path_root(path.ptr);
@@ -150,7 +151,7 @@ void test_core_env__0(void)
reset_global_search_path();
cl_assert_equal_i(
- GIT_ENOTFOUND, git_futils_find_global_file(&found, testfile));
+ GIT_ENOTFOUND, git_sysdir_find_global_file(&found, testfile));
old = path.ptr[root];
path.ptr[root] = '\0';
@@ -159,7 +160,7 @@ void test_core_env__0(void)
setenv_and_check("HOMEPATH", &path.ptr[root]);
reset_global_search_path();
- cl_git_pass(git_futils_find_global_file(&found, testfile));
+ cl_git_pass(git_sysdir_find_global_file(&found, testfile));
}
}
#endif
@@ -177,7 +178,7 @@ void test_core_env__1(void)
git_buf path = GIT_BUF_INIT;
cl_assert_equal_i(
- GIT_ENOTFOUND, git_futils_find_global_file(&path, "nonexistentfile"));
+ GIT_ENOTFOUND, git_sysdir_find_global_file(&path, "nonexistentfile"));
cl_git_pass(cl_setenv("HOME", "doesnotexist"));
#ifdef GIT_WIN32
@@ -187,7 +188,7 @@ void test_core_env__1(void)
reset_global_search_path();
cl_assert_equal_i(
- GIT_ENOTFOUND, git_futils_find_global_file(&path, "nonexistentfile"));
+ GIT_ENOTFOUND, git_sysdir_find_global_file(&path, "nonexistentfile"));
cl_git_pass(cl_setenv("HOME", NULL));
#ifdef GIT_WIN32
@@ -198,17 +199,17 @@ void test_core_env__1(void)
reset_system_search_path();
cl_assert_equal_i(
- GIT_ENOTFOUND, git_futils_find_global_file(&path, "nonexistentfile"));
+ GIT_ENOTFOUND, git_sysdir_find_global_file(&path, "nonexistentfile"));
cl_assert_equal_i(
- GIT_ENOTFOUND, git_futils_find_system_file(&path, "nonexistentfile"));
+ GIT_ENOTFOUND, git_sysdir_find_system_file(&path, "nonexistentfile"));
#ifdef GIT_WIN32
cl_git_pass(cl_setenv("PROGRAMFILES", NULL));
reset_system_search_path();
cl_assert_equal_i(
- GIT_ENOTFOUND, git_futils_find_system_file(&path, "nonexistentfile"));
+ GIT_ENOTFOUND, git_sysdir_find_system_file(&path, "nonexistentfile"));
#endif
git_buf_free(&path);
@@ -242,13 +243,13 @@ static void check_global_searchpath(
cl_assert_equal_s(out, path);
/* find file using new path */
- cl_git_pass(git_futils_find_global_file(temp, file));
+ cl_git_pass(git_sysdir_find_global_file(temp, file));
/* reset path and confirm file not found */
cl_git_pass(git_libgit2_opts(
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, NULL));
cl_assert_equal_i(
- GIT_ENOTFOUND, git_futils_find_global_file(temp, file));
+ GIT_ENOTFOUND, git_sysdir_find_global_file(temp, file));
}
void test_core_env__2(void)
@@ -285,7 +286,7 @@ void test_core_env__2(void)
/* default should be NOTFOUND */
cl_assert_equal_i(
- GIT_ENOTFOUND, git_futils_find_global_file(&found, testfile));
+ GIT_ENOTFOUND, git_sysdir_find_global_file(&found, testfile));
/* try plain, append $PATH, and prepend $PATH */
check_global_searchpath(path.ptr, 0, testfile, &found);
diff --git a/tests/index/addall.c b/tests/index/addall.c
index 452733710..a7e2583b2 100644
--- a/tests/index/addall.c
+++ b/tests/index/addall.c
@@ -3,7 +3,7 @@
#include "posix.h"
#include "fileops.h"
-git_repository *g_repo = NULL;
+static git_repository *g_repo = NULL;
#define TEST_DIR "addall"
void test_index_addall__initialize(void)
diff --git a/tests/repo/config.c b/tests/repo/config.c
index e77acc8c5..2e7be37aa 100644
--- a/tests/repo/config.c
+++ b/tests/repo/config.c
@@ -1,4 +1,5 @@
#include "clar_libgit2.h"
+#include "sysdir.h"
#include "fileops.h"
#include <ctype.h>
@@ -47,7 +48,7 @@ void test_repo_config__open_missing_global(void)
git_config_free(config);
git_repository_free(repo);
- git_futils_dirs_global_shutdown();
+ git_sysdir_global_shutdown();
}
void test_repo_config__open_missing_global_with_separators(void)
@@ -76,7 +77,7 @@ void test_repo_config__open_missing_global_with_separators(void)
git_config_free(config);
git_repository_free(repo);
- git_futils_dirs_global_shutdown();
+ git_sysdir_global_shutdown();
}
#include "repository.h"
@@ -105,7 +106,7 @@ void test_repo_config__read_no_configs(void)
cl_assert_equal_i(GIT_ABBREV_DEFAULT, val);
git_repository_free(repo);
- git_futils_dirs_global_shutdown();
+ git_sysdir_global_shutdown();
/* with just system */
@@ -204,5 +205,5 @@ void test_repo_config__read_no_configs(void)
cl_assert(!git_path_exists("empty_standard_repo/.git/config"));
cl_assert(!git_path_exists("alternate/3/.gitconfig"));
- git_futils_dirs_global_shutdown();
+ git_sysdir_global_shutdown();
}
diff --git a/tests/repo/iterator.c b/tests/repo/iterator.c
index 56b51852c..fb70a9ea0 100644
--- a/tests/repo/iterator.c
+++ b/tests/repo/iterator.c
@@ -156,7 +156,7 @@ void test_repo_iterator__index_icase(void)
{
git_iterator *i;
git_index *index;
- unsigned int caps;
+ int caps;
g_repo = cl_git_sandbox_init("icase");
diff --git a/tests/repo/open.c b/tests/repo/open.c
index 7cfe041c2..f7420bd3a 100644
--- a/tests/repo/open.c
+++ b/tests/repo/open.c
@@ -1,5 +1,6 @@
#include "clar_libgit2.h"
#include "fileops.h"
+#include "sysdir.h"
#include <ctype.h>
void test_repo_open__cleanup(void)
@@ -323,7 +324,7 @@ void test_repo_open__no_config(void)
git_repository_free(repo);
cl_fixture_cleanup("empty_standard_repo");
- git_futils_dirs_global_shutdown();
+ git_sysdir_global_shutdown();
}
void test_repo_open__force_bare(void)
diff --git a/tests/repo/shallow.c b/tests/repo/shallow.c
index 1cc66ae40..5aeaf2def 100644
--- a/tests/repo/shallow.c
+++ b/tests/repo/shallow.c
@@ -31,3 +31,9 @@ void test_repo_shallow__shallow_repo(void)
cl_assert_equal_i(1, git_repository_is_shallow(g_repo));
}
+void test_repo_shallow__clears_errors(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo.git");
+ cl_assert_equal_i(0, git_repository_is_shallow(g_repo));
+ cl_assert_equal_p(NULL, giterr_last());
+}