summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/attr/repo.c2
-rw-r--r--tests/checkout/conflict.c24
-rw-r--r--tests/checkout/crlf.c18
-rw-r--r--tests/checkout/head.c24
-rw-r--r--tests/checkout/icase.c22
-rw-r--r--tests/checkout/index.c62
-rw-r--r--tests/checkout/nasty.c6
-rw-r--r--tests/checkout/tree.c192
-rw-r--r--tests/checkout/typechange.c34
-rw-r--r--tests/cherrypick/workdir.c18
-rw-r--r--tests/clar_libgit2.c20
-rw-r--r--tests/clone/nonetwork.c16
-rw-r--r--tests/config/global.c8
-rw-r--r--tests/config/read.c8
-rw-r--r--tests/config/readonly.c10
-rw-r--r--tests/config/stress.c6
-rw-r--r--tests/core/copy.c80
-rw-r--r--tests/core/dirent.c48
-rw-r--r--tests/core/env.c6
-rw-r--r--tests/core/filebuf.c24
-rw-r--r--tests/core/futils.c6
-rw-r--r--tests/core/iconv.c20
-rw-r--r--tests/core/mkdir.c108
-rw-r--r--tests/core/path.c98
-rw-r--r--tests/core/posix.c12
-rw-r--r--tests/core/rmdir.c26
-rw-r--r--tests/core/stat.c2
-rw-r--r--tests/diff/drivers.c2
-rw-r--r--tests/diff/workdir.c10
-rw-r--r--tests/fetchhead/nonetwork.c8
-rw-r--r--tests/ignore/path.c4
-rw-r--r--tests/index/crlf.c16
-rw-r--r--tests/index/tests.c4
-rw-r--r--tests/iterator/index.c2
-rw-r--r--tests/iterator/workdir.c2
-rw-r--r--tests/merge/merge_helpers.c2
-rw-r--r--tests/merge/workdir/setup.c178
-rw-r--r--tests/merge/workdir/simple.c2
-rw-r--r--tests/object/blob/write.c4
-rw-r--r--tests/object/raw/write.c4
-rw-r--r--tests/odb/alternates.c2
-rw-r--r--tests/odb/emptyobjects.c2
-rw-r--r--tests/online/clone.c6
-rw-r--r--tests/online/customcert.c4
-rw-r--r--tests/pack/indexer.c2
-rw-r--r--tests/pack/packbuilder.c4
-rw-r--r--tests/path/core.c427
-rw-r--r--tests/path/dotgit.c94
-rw-r--r--tests/refs/branches/create.c2
-rw-r--r--tests/refs/branches/delete.c8
-rw-r--r--tests/refs/delete.c4
-rw-r--r--tests/refs/pack.c4
-rw-r--r--tests/refs/ref_helpers.c2
-rw-r--r--tests/refs/reflog/reflog.c18
-rw-r--r--tests/refs/rename.c12
-rw-r--r--tests/refs/revparse.c4
-rw-r--r--tests/repo/config.c22
-rw-r--r--tests/repo/discover.c6
-rw-r--r--tests/repo/env.c10
-rw-r--r--tests/repo/init.c26
-rw-r--r--tests/repo/open.c10
-rw-r--r--tests/repo/setters.c2
-rw-r--r--tests/repo/template.c6
-rw-r--r--tests/reset/hard.c12
-rw-r--r--tests/revert/workdir.c10
-rw-r--r--tests/stash/drop.c14
-rw-r--r--tests/stash/save.c20
-rw-r--r--tests/status/submodules.c12
-rw-r--r--tests/status/worktree.c10
-rw-r--r--tests/submodule/add.c16
-rw-r--r--tests/submodule/init.c6
-rw-r--r--tests/submodule/open.c10
-rw-r--r--tests/submodule/repository_init.c8
-rw-r--r--tests/submodule/submodule_helpers.c2
-rw-r--r--tests/worktree/merge.c2
-rw-r--r--tests/worktree/refs.c4
-rw-r--r--tests/worktree/submodule.c2
-rw-r--r--tests/worktree/worktree.c14
78 files changed, 1002 insertions, 955 deletions
diff --git a/tests/attr/repo.c b/tests/attr/repo.c
index e7b975290..abd238154 100644
--- a/tests/attr/repo.c
+++ b/tests/attr/repo.c
@@ -283,7 +283,7 @@ void test_attr_repo__bare_repo_with_index(void)
git_index_free(index);
cl_must_pass(p_unlink("attr/.gitattributes"));
- cl_assert(!git_path_exists("attr/.gitattributes"));
+ cl_assert(!git_fs_path_exists("attr/.gitattributes"));
cl_git_pass(git_repository_set_bare(g_repo));
diff --git a/tests/checkout/conflict.c b/tests/checkout/conflict.c
index 3f5e7162d..4a9e4b9fa 100644
--- a/tests/checkout/conflict.c
+++ b/tests/checkout/conflict.c
@@ -227,7 +227,7 @@ void test_checkout_conflict__ignored(void)
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
- cl_assert(!git_path_exists(TEST_REPO_PATH "/conflicting.txt"));
+ cl_assert(!git_fs_path_exists(TEST_REPO_PATH "/conflicting.txt"));
}
void test_checkout_conflict__ours(void)
@@ -1030,15 +1030,15 @@ void test_checkout_conflict__update_only(void)
ensure_workdir_contents("automergeable.txt", AUTOMERGEABLE_MERGED_FILE);
ensure_workdir("directory_file-two/file", 0100644, CONFLICTING_OURS_OID);
- cl_assert(!git_path_exists("merge-resolve/modify-delete"));
- cl_assert(!git_path_exists("merge-resolve/test-one.txt"));
- cl_assert(!git_path_exists("merge-resolve/test-one-side-one.txt"));
- cl_assert(!git_path_exists("merge-resolve/test-one-side-two.txt"));
- cl_assert(!git_path_exists("merge-resolve/test-one.txt~ours"));
- cl_assert(!git_path_exists("merge-resolve/test-one.txt~theirs"));
- cl_assert(!git_path_exists("merge-resolve/directory_file-one/file"));
- cl_assert(!git_path_exists("merge-resolve/directory_file-one~ours"));
- cl_assert(!git_path_exists("merge-resolve/directory_file-two~theirs"));
+ cl_assert(!git_fs_path_exists("merge-resolve/modify-delete"));
+ cl_assert(!git_fs_path_exists("merge-resolve/test-one.txt"));
+ cl_assert(!git_fs_path_exists("merge-resolve/test-one-side-one.txt"));
+ cl_assert(!git_fs_path_exists("merge-resolve/test-one-side-two.txt"));
+ cl_assert(!git_fs_path_exists("merge-resolve/test-one.txt~ours"));
+ cl_assert(!git_fs_path_exists("merge-resolve/test-one.txt~theirs"));
+ cl_assert(!git_fs_path_exists("merge-resolve/directory_file-one/file"));
+ cl_assert(!git_fs_path_exists("merge-resolve/directory_file-one~ours"));
+ cl_assert(!git_fs_path_exists("merge-resolve/directory_file-two~theirs"));
}
void test_checkout_conflict__path_filters(void)
@@ -1076,9 +1076,9 @@ void test_checkout_conflict__path_filters(void)
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
ensure_workdir_contents("conflicting-1.txt", CONFLICTING_DIFF3_FILE);
- cl_assert(!git_path_exists("merge-resolve/conflicting-2.txt"));
+ cl_assert(!git_fs_path_exists("merge-resolve/conflicting-2.txt"));
ensure_workdir_contents("conflicting-3.txt", AUTOMERGEABLE_MERGED_FILE);
- cl_assert(!git_path_exists("merge-resolve/conflicting-4.txt"));
+ cl_assert(!git_fs_path_exists("merge-resolve/conflicting-4.txt"));
}
static void collect_progress(
diff --git a/tests/checkout/crlf.c b/tests/checkout/crlf.c
index eb4c61f39..8fd16a004 100644
--- a/tests/checkout/crlf.c
+++ b/tests/checkout/crlf.c
@@ -17,7 +17,7 @@ static int unlink_file(void *payload, git_str *path)
{
char *fn;
- cl_assert(fn = git_path_basename(path->ptr));
+ cl_assert(fn = git_fs_path_basename(path->ptr));
GIT_UNUSED(payload);
@@ -39,7 +39,7 @@ void test_checkout_crlf__initialize(void)
* check out over it.
*/
cl_git_pass(git_str_puts(&reponame, "crlf"));
- cl_git_pass(git_path_direach(&reponame, 0, unlink_file, NULL));
+ cl_git_pass(git_fs_path_direach(&reponame, 0, unlink_file, NULL));
if (GIT_EOL_NATIVE == GIT_EOL_CRLF)
systype = "windows";
@@ -76,7 +76,7 @@ static int compare_file(void *payload, git_str *actual_path)
int cmp_git, cmp_gitattributes;
char *basename;
- basename = git_path_basename(actual_path->ptr);
+ basename = git_fs_path_basename(actual_path->ptr);
cmp_git = strcmp(basename, ".git");
cmp_gitattributes = strcmp(basename, ".gitattributes");
@@ -87,8 +87,8 @@ static int compare_file(void *payload, git_str *actual_path)
cl_git_pass(git_str_joinpath(&expected_path, cd->dirname, basename));
- if (!git_path_isfile(expected_path.ptr) ||
- !git_path_isfile(actual_path->ptr))
+ if (!git_fs_path_isfile(expected_path.ptr) ||
+ !git_fs_path_isfile(actual_path->ptr))
goto done;
if (git_futils_readbuffer(&actual_contents, actual_path->ptr) < 0 ||
@@ -107,7 +107,7 @@ done:
if (failed) {
git_str details = GIT_STR_INIT;
git_str_printf(&details, "filename=%s, system=%s, autocrlf=%s, attrs={%s}",
- git_path_basename(actual_path->ptr), systype, cd->autocrlf, cd->attrs);
+ git_fs_path_basename(actual_path->ptr), systype, cd->autocrlf, cd->attrs);
clar__fail(__FILE__, __func__, __LINE__,
"checked out contents did not match expected", details.ptr, 0);
git_str_dispose(&details);
@@ -166,7 +166,7 @@ static void test_checkout(const char *autocrlf, const char *attrs)
cl_git_pass(git_checkout_head(g_repo, &opts));
compare_data.dirname = sandboxname.ptr;
- cl_git_pass(git_path_direach(&reponame, 0, compare_file, &compare_data));
+ cl_git_pass(git_fs_path_direach(&reponame, 0, compare_file, &compare_data));
cl_fixture_cleanup(expected_fixture.ptr);
git_str_dispose(&expected_fixture);
@@ -187,9 +187,9 @@ static void empty_workdir(const char *name)
size_t i;
const char *fn;
- cl_git_pass(git_path_dirload(&contents, name, 0, 0));
+ cl_git_pass(git_fs_path_dirload(&contents, name, 0, 0));
git_vector_foreach(&contents, i, fn) {
- cl_assert(basename = git_path_basename(fn));
+ cl_assert(basename = git_fs_path_basename(fn));
cmp = strncasecmp(basename, ".git", 4);
git__free(basename);
diff --git a/tests/checkout/head.c b/tests/checkout/head.c
index 5b3a034e7..3b0bf4729 100644
--- a/tests/checkout/head.c
+++ b/tests/checkout/head.c
@@ -43,7 +43,7 @@ void test_checkout_head__with_index_only_tree(void)
cl_git_pass(git_index_add_bypath(index, "newdir/newfile.txt"));
cl_git_pass(git_index_write(index));
- cl_assert(git_path_isfile("testrepo/newdir/newfile.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/newdir/newfile.txt"));
cl_assert(git_index_get_bypath(index, "newdir/newfile.txt", 0) != NULL);
git_index_free(index);
@@ -55,7 +55,7 @@ void test_checkout_head__with_index_only_tree(void)
cl_git_pass(git_repository_index(&index, g_repo));
- cl_assert(!git_path_isfile("testrepo/newdir/newfile.txt"));
+ cl_assert(!git_fs_path_isfile("testrepo/newdir/newfile.txt"));
cl_assert(git_index_get_bypath(index, "newdir/newfile.txt", 0) == NULL);
git_index_free(index);
@@ -79,8 +79,8 @@ void test_checkout_head__do_not_remove_untracked_file(void)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_checkout_head(g_repo, &opts));
- cl_assert(!git_path_isfile("testrepo/tracked/tracked"));
- cl_assert(git_path_isfile("testrepo/tracked/untracked"));
+ cl_assert(!git_fs_path_isfile("testrepo/tracked/tracked"));
+ cl_assert(git_fs_path_isfile("testrepo/tracked/untracked"));
}
void test_checkout_head__do_not_remove_untracked_file_in_subdir(void)
@@ -104,9 +104,9 @@ void test_checkout_head__do_not_remove_untracked_file_in_subdir(void)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_checkout_head(g_repo, &opts));
- cl_assert(!git_path_isfile("testrepo/tracked/tracked"));
- cl_assert(!git_path_isfile("testrepo/tracked/subdir/tracked"));
- cl_assert(git_path_isfile("testrepo/tracked/subdir/untracked"));
+ cl_assert(!git_fs_path_isfile("testrepo/tracked/tracked"));
+ cl_assert(!git_fs_path_isfile("testrepo/tracked/subdir/tracked"));
+ cl_assert(git_fs_path_isfile("testrepo/tracked/subdir/untracked"));
}
void test_checkout_head__do_remove_untracked_paths(void)
@@ -131,8 +131,8 @@ void test_checkout_head__do_remove_untracked_paths(void)
opts.paths.count = 1;
cl_git_pass(git_checkout_head(g_repo, &opts));
- cl_assert(git_path_isfile("testrepo/tracked/tracked"));
- cl_assert(!git_path_isfile("testrepo/tracked/untracked"));
+ cl_assert(git_fs_path_isfile("testrepo/tracked/tracked"));
+ cl_assert(!git_fs_path_isfile("testrepo/tracked/untracked"));
}
void test_checkout_head__do_remove_tracked_subdir(void)
@@ -158,9 +158,9 @@ void test_checkout_head__do_remove_tracked_subdir(void)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_checkout_head(g_repo, &opts));
- cl_assert(!git_path_isdir("testrepo/subdir/tracked"));
- cl_assert(!git_path_isfile("testrepo/subdir/tracked-file"));
- cl_assert(git_path_isfile("testrepo/subdir/untracked-file"));
+ cl_assert(!git_fs_path_isdir("testrepo/subdir/tracked"));
+ cl_assert(!git_fs_path_isfile("testrepo/subdir/tracked-file"));
+ cl_assert(git_fs_path_isfile("testrepo/subdir/untracked-file"));
}
void test_checkout_head__typechange_workdir(void)
diff --git a/tests/checkout/icase.c b/tests/checkout/icase.c
index 6c30765a3..d77c7abd5 100644
--- a/tests/checkout/icase.c
+++ b/tests/checkout/icase.c
@@ -50,8 +50,8 @@ static char *get_filename(const char *in)
DIR *dir;
struct dirent *de;
- cl_assert(search_dirname = git_path_dirname(in));
- cl_assert(search_filename = git_path_basename(in));
+ cl_assert(search_dirname = git_fs_path_dirname(in));
+ cl_assert(search_filename = git_fs_path_basename(in));
cl_assert(dir = opendir(search_dirname));
@@ -134,7 +134,7 @@ void test_checkout_icase__refuses_to_overwrite_links_for_files(void)
cl_git_fail(git_checkout_tree(repo, obj, &checkout_opts));
- cl_assert(!git_path_exists("tmp"));
+ cl_assert(!git_fs_path_exists("tmp"));
assert_name_is("testrepo/BRANCH_FILE.txt");
}
@@ -146,7 +146,7 @@ void test_checkout_icase__overwrites_links_for_files_when_forced(void)
cl_git_pass(git_checkout_tree(repo, obj, &checkout_opts));
- cl_assert(!git_path_exists("tmp"));
+ cl_assert(!git_fs_path_exists("tmp"));
assert_name_is("testrepo/new.txt");
}
@@ -159,7 +159,7 @@ void test_checkout_icase__overwrites_empty_folders_for_files(void)
cl_git_pass(git_checkout_tree(repo, obj, &checkout_opts));
assert_name_is("testrepo/new.txt");
- cl_assert(!git_path_isdir("testrepo/new.txt"));
+ cl_assert(!git_fs_path_isdir("testrepo/new.txt"));
}
void test_checkout_icase__refuses_to_overwrite_populated_folders_for_files(void)
@@ -173,7 +173,7 @@ void test_checkout_icase__refuses_to_overwrite_populated_folders_for_files(void)
cl_git_fail(git_checkout_tree(repo, obj, &checkout_opts));
assert_name_is("testrepo/BRANCH_FILE.txt");
- cl_assert(git_path_isdir("testrepo/BRANCH_FILE.txt"));
+ cl_assert(git_fs_path_isdir("testrepo/BRANCH_FILE.txt"));
}
void test_checkout_icase__overwrites_folders_for_files_when_forced(void)
@@ -187,7 +187,7 @@ void test_checkout_icase__overwrites_folders_for_files_when_forced(void)
cl_git_pass(git_checkout_tree(repo, obj, &checkout_opts));
assert_name_is("testrepo/new.txt");
- cl_assert(!git_path_isdir("testrepo/new.txt"));
+ cl_assert(!git_fs_path_isdir("testrepo/new.txt"));
}
void test_checkout_icase__refuses_to_overwrite_files_for_folders(void)
@@ -199,7 +199,7 @@ void test_checkout_icase__refuses_to_overwrite_files_for_folders(void)
cl_git_fail(git_checkout_tree(repo, obj, &checkout_opts));
assert_name_is("testrepo/A");
- cl_assert(!git_path_isdir("testrepo/A"));
+ cl_assert(!git_fs_path_isdir("testrepo/A"));
}
void test_checkout_icase__overwrites_files_for_folders_when_forced(void)
@@ -211,7 +211,7 @@ void test_checkout_icase__overwrites_files_for_folders_when_forced(void)
cl_git_pass(git_checkout_tree(repo, obj, &checkout_opts));
assert_name_is("testrepo/a");
- cl_assert(git_path_isdir("testrepo/a"));
+ cl_assert(git_fs_path_isdir("testrepo/a"));
}
void test_checkout_icase__refuses_to_overwrite_links_for_folders(void)
@@ -222,7 +222,7 @@ void test_checkout_icase__refuses_to_overwrite_links_for_folders(void)
cl_git_fail(git_checkout_tree(repo, obj, &checkout_opts));
- cl_assert(!git_path_exists("b.txt"));
+ cl_assert(!git_fs_path_exists("b.txt"));
assert_name_is("testrepo/A");
}
@@ -234,7 +234,7 @@ void test_checkout_icase__overwrites_links_for_folders_when_forced(void)
cl_git_pass(git_checkout_tree(repo, obj, &checkout_opts));
- cl_assert(!git_path_exists("b.txt"));
+ cl_assert(!git_fs_path_exists("b.txt"));
assert_name_is("testrepo/a");
}
diff --git a/tests/checkout/index.c b/tests/checkout/index.c
index 13eecc984..6a80d22c5 100644
--- a/tests/checkout/index.c
+++ b/tests/checkout/index.c
@@ -56,9 +56,9 @@ void test_checkout_index__can_create_missing_files(void)
{
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
- cl_assert_equal_i(false, git_path_isfile("./testrepo/branch_file.txt"));
- cl_assert_equal_i(false, git_path_isfile("./testrepo/new.txt"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/README"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/branch_file.txt"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/new.txt"));
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING;
@@ -77,7 +77,7 @@ void test_checkout_index__can_remove_untracked_files(void)
cl_git_mkfile("./testrepo/dir/one", "one\n");
cl_git_mkfile("./testrepo/dir/subdir/two", "two\n");
- cl_assert_equal_i(true, git_path_isdir("./testrepo/dir/subdir/subsubdir"));
+ cl_assert_equal_i(true, git_fs_path_isdir("./testrepo/dir/subdir/subsubdir"));
opts.checkout_strategy =
GIT_CHECKOUT_SAFE |
@@ -86,7 +86,7 @@ void test_checkout_index__can_remove_untracked_files(void)
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- cl_assert_equal_i(false, git_path_isdir("./testrepo/dir"));
+ cl_assert_equal_i(false, git_fs_path_isdir("./testrepo/dir"));
}
void test_checkout_index__can_disable_pathspec_match(void)
@@ -152,15 +152,15 @@ void test_checkout_index__honor_the_specified_pathspecs(void)
opts.paths.strings = entries;
opts.paths.count = 1;
- cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
- cl_assert_equal_i(false, git_path_isfile("./testrepo/branch_file.txt"));
- cl_assert_equal_i(false, git_path_isfile("./testrepo/new.txt"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/README"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/branch_file.txt"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/new.txt"));
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING;
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/README"));
check_file_contents("./testrepo/branch_file.txt", "hi\nbye!\n");
check_file_contents("./testrepo/new.txt", "my new file\n");
}
@@ -236,7 +236,7 @@ void test_checkout_index__honor_coresymlinks_default_true(void)
cl_must_pass(p_mkdir("symlink", 0777));
- if (!git_path_supports_symlinks("symlink/test"))
+ if (!git_fs_path_supports_symlinks("symlink/test"))
cl_skip();
#ifdef GIT_WIN32
@@ -269,7 +269,7 @@ void test_checkout_index__honor_coresymlinks_default_false(void)
* supports symlinks. Bail entirely on POSIX platforms that
* do support symlinks.
*/
- if (git_path_supports_symlinks("symlink/test"))
+ if (git_fs_path_supports_symlinks("symlink/test"))
cl_skip();
#endif
@@ -281,7 +281,7 @@ void test_checkout_index__coresymlinks_set_to_true_fails_when_unsupported(void)
{
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- if (git_path_supports_symlinks("testrepo/test")) {
+ if (git_fs_path_supports_symlinks("testrepo/test")) {
cl_skip();
}
@@ -297,7 +297,7 @@ void test_checkout_index__honor_coresymlinks_setting_set_to_true(void)
char link_data[GIT_PATH_MAX];
size_t link_size = GIT_PATH_MAX;
- if (!git_path_supports_symlinks("testrepo/test")) {
+ if (!git_fs_path_supports_symlinks("testrepo/test")) {
cl_skip();
}
@@ -578,8 +578,8 @@ void test_checkout_index__can_overcome_name_clashes(void)
cl_git_pass(p_mkdir("./testrepo/path0", 0777));
cl_git_mkfile("./testrepo/path0/file0", "content\r\n");
- cl_assert(git_path_isfile("./testrepo/path1"));
- cl_assert(git_path_isfile("./testrepo/path0/file0"));
+ cl_assert(git_fs_path_isfile("./testrepo/path1"));
+ cl_assert(git_fs_path_isfile("./testrepo/path0/file0"));
opts.checkout_strategy =
GIT_CHECKOUT_SAFE |
@@ -587,14 +587,14 @@ void test_checkout_index__can_overcome_name_clashes(void)
GIT_CHECKOUT_ALLOW_CONFLICTS;
cl_git_pass(git_checkout_index(g_repo, index, &opts));
- cl_assert(git_path_isfile("./testrepo/path1"));
- cl_assert(git_path_isfile("./testrepo/path0/file0"));
+ cl_assert(git_fs_path_isfile("./testrepo/path1"));
+ cl_assert(git_fs_path_isfile("./testrepo/path0/file0"));
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_checkout_index(g_repo, index, &opts));
- cl_assert(git_path_isfile("./testrepo/path0"));
- cl_assert(git_path_isfile("./testrepo/path1/file1"));
+ cl_assert(git_fs_path_isfile("./testrepo/path0"));
+ cl_assert(git_fs_path_isfile("./testrepo/path1/file1"));
git_index_free(index);
}
@@ -622,9 +622,9 @@ void test_checkout_index__can_update_prefixed_files(void)
{
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
- cl_assert_equal_i(false, git_path_isfile("./testrepo/branch_file.txt"));
- cl_assert_equal_i(false, git_path_isfile("./testrepo/new.txt"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/README"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/branch_file.txt"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/new.txt"));
cl_git_mkfile("./testrepo/READ", "content\n");
cl_git_mkfile("./testrepo/README.after", "content\n");
@@ -647,10 +647,10 @@ void test_checkout_index__can_update_prefixed_files(void)
check_file_contents_nocr("./testrepo/branch_file.txt", "hi\nbye!\n");
check_file_contents_nocr("./testrepo/new.txt", "my new file\n");
- cl_assert(!git_path_exists("testrepo/READ"));
- cl_assert(!git_path_exists("testrepo/README.after"));
- cl_assert(!git_path_exists("testrepo/branch_file"));
- cl_assert(!git_path_exists("testrepo/branch_file.txt.after"));
+ cl_assert(!git_fs_path_exists("testrepo/READ"));
+ cl_assert(!git_fs_path_exists("testrepo/README.after"));
+ cl_assert(!git_fs_path_exists("testrepo/branch_file"));
+ cl_assert(!git_fs_path_exists("testrepo/branch_file.txt.after"));
}
void test_checkout_index__can_checkout_a_newly_initialized_repository(void)
@@ -688,7 +688,7 @@ void test_checkout_index__target_directory(void)
opts.checkout_strategy = GIT_CHECKOUT_SAFE |
GIT_CHECKOUT_RECREATE_MISSING;
opts.target_directory = "alternative";
- cl_assert(!git_path_isdir("alternative"));
+ cl_assert(!git_fs_path_isdir("alternative"));
opts.notify_flags = GIT_CHECKOUT_NOTIFY_ALL;
opts.notify_cb = checkout_count_callback;
@@ -741,7 +741,7 @@ void test_checkout_index__target_directory_from_bare(void)
cl_git_fail(git_checkout_index(g_repo, NULL, &opts));
opts.target_directory = "alternative";
- cl_assert(!git_path_isdir("alternative"));
+ cl_assert(!git_fs_path_isdir("alternative"));
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
@@ -765,9 +765,9 @@ void test_checkout_index__can_get_repo_from_index(void)
git_index *index;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
- cl_assert_equal_i(false, git_path_isfile("./testrepo/branch_file.txt"));
- cl_assert_equal_i(false, git_path_isfile("./testrepo/new.txt"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/README"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/branch_file.txt"));
+ cl_assert_equal_i(false, git_fs_path_isfile("./testrepo/new.txt"));
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING;
diff --git a/tests/checkout/nasty.c b/tests/checkout/nasty.c
index a1b3164be..732f1d5e8 100644
--- a/tests/checkout/nasty.c
+++ b/tests/checkout/nasty.c
@@ -38,7 +38,7 @@ static void test_checkout_passes(const char *refname, const char *filename)
GIT_CHECKOUT_DONT_UPDATE_INDEX;
cl_git_pass(git_checkout_tree(repo, (const git_object *)commit, &opts));
- cl_assert(!git_path_exists(path.ptr));
+ cl_assert(!git_fs_path_exists(path.ptr));
git_commit_free(commit);
git_str_dispose(&path);
@@ -59,7 +59,7 @@ static void test_checkout_fails(const char *refname, const char *filename)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_fail(git_checkout_tree(repo, (const git_object *)commit, &opts));
- cl_assert(!git_path_exists(path.ptr));
+ cl_assert(!git_fs_path_exists(path.ptr));
git_commit_free(commit);
git_str_dispose(&path);
@@ -246,7 +246,7 @@ void test_checkout_nasty__only_looks_like_a_git_shortname(void)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_checkout_tree(repo, (const git_object *)commit, &opts));
- cl_assert(git_path_exists("nasty/git~3/foobar"));
+ cl_assert(git_fs_path_exists("nasty/git~3/foobar"));
git_commit_free(commit);
#endif
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c
index cdfb456b7..2f54f4e3e 100644
--- a/tests/checkout/tree.c
+++ b/tests/checkout/tree.c
@@ -34,7 +34,7 @@ void test_checkout_tree__cleanup(void)
cl_git_sandbox_cleanup();
- if (git_path_isdir("alternative"))
+ if (git_fs_path_isdir("alternative"))
git_futils_rmdir_r("alternative", NULL, GIT_RMDIR_REMOVE_FILES);
}
@@ -54,17 +54,17 @@ void test_checkout_tree__can_checkout_a_subdirectory_from_a_commit(void)
cl_git_pass(git_revparse_single(&g_object, g_repo, "subtrees"));
- cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/"));
+ cl_assert_equal_i(false, git_fs_path_isdir("./testrepo/ab/"));
cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
- cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/2.txt"));
- cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/fgh/1.txt"));
+ cl_assert_equal_i(true, git_fs_path_isfile("./testrepo/ab/de/2.txt"));
+ cl_assert_equal_i(true, git_fs_path_isfile("./testrepo/ab/de/fgh/1.txt"));
}
void test_checkout_tree__can_checkout_and_remove_directory(void)
{
- cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/"));
+ cl_assert_equal_i(false, git_fs_path_isdir("./testrepo/ab/"));
/* Checkout brach "subtrees" and update HEAD, so that HEAD matches the
* current working tree
@@ -74,9 +74,9 @@ void test_checkout_tree__can_checkout_and_remove_directory(void)
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees"));
- cl_assert_equal_i(true, git_path_isdir("./testrepo/ab/"));
- cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/2.txt"));
- cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/fgh/1.txt"));
+ cl_assert_equal_i(true, git_fs_path_isdir("./testrepo/ab/"));
+ cl_assert_equal_i(true, git_fs_path_isfile("./testrepo/ab/de/2.txt"));
+ cl_assert_equal_i(true, git_fs_path_isfile("./testrepo/ab/de/fgh/1.txt"));
git_object_free(g_object);
g_object = NULL;
@@ -90,7 +90,7 @@ void test_checkout_tree__can_checkout_and_remove_directory(void)
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/master"));
/* This directory should no longer exist */
- cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/"));
+ cl_assert_equal_i(false, git_fs_path_isdir("./testrepo/ab/"));
}
void test_checkout_tree__can_checkout_a_subdirectory_from_a_subtree(void)
@@ -102,12 +102,12 @@ void test_checkout_tree__can_checkout_a_subdirectory_from_a_subtree(void)
cl_git_pass(git_revparse_single(&g_object, g_repo, "subtrees:ab"));
- cl_assert_equal_i(false, git_path_isdir("./testrepo/de/"));
+ cl_assert_equal_i(false, git_fs_path_isdir("./testrepo/de/"));
cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
- cl_assert_equal_i(true, git_path_isfile("./testrepo/de/2.txt"));
- cl_assert_equal_i(true, git_path_isfile("./testrepo/de/fgh/1.txt"));
+ cl_assert_equal_i(true, git_fs_path_isfile("./testrepo/de/2.txt"));
+ cl_assert_equal_i(true, git_fs_path_isfile("./testrepo/de/fgh/1.txt"));
}
static void progress(const char *path, size_t cur, size_t tot, void *payload)
@@ -149,7 +149,7 @@ void test_checkout_tree__doesnt_write_unrequested_files_to_worktree(void)
*/
opts.checkout_strategy = GIT_CHECKOUT_NONE;
git_checkout_tree(g_repo, (git_object*)p_chomped_commit, &opts);
- cl_assert_equal_i(false, git_path_isfile("testrepo/readme.txt"));
+ cl_assert_equal_i(false, git_fs_path_isfile("testrepo/readme.txt"));
git_commit_free(p_master_commit);
git_commit_free(p_chomped_commit);
@@ -174,12 +174,12 @@ void test_checkout_tree__can_switch_branches(void)
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir"));
- cl_assert(git_path_isfile("testrepo/README"));
- cl_assert(git_path_isfile("testrepo/branch_file.txt"));
- cl_assert(git_path_isfile("testrepo/new.txt"));
- cl_assert(git_path_isfile("testrepo/a/b.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/README"));
+ cl_assert(git_fs_path_isfile("testrepo/branch_file.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/new.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/a/b.txt"));
- cl_assert(!git_path_isdir("testrepo/ab"));
+ cl_assert(!git_fs_path_isdir("testrepo/ab"));
assert_on_branch(g_repo, "dir");
@@ -194,15 +194,15 @@ void test_checkout_tree__can_switch_branches(void)
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees"));
- cl_assert(git_path_isfile("testrepo/README"));
- cl_assert(git_path_isfile("testrepo/branch_file.txt"));
- cl_assert(git_path_isfile("testrepo/new.txt"));
- cl_assert(git_path_isfile("testrepo/ab/4.txt"));
- cl_assert(git_path_isfile("testrepo/ab/c/3.txt"));
- cl_assert(git_path_isfile("testrepo/ab/de/2.txt"));
- cl_assert(git_path_isfile("testrepo/ab/de/fgh/1.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/README"));
+ cl_assert(git_fs_path_isfile("testrepo/branch_file.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/new.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/ab/4.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/ab/c/3.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/ab/de/2.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/ab/de/fgh/1.txt"));
- cl_assert(!git_path_isdir("testrepo/a"));
+ cl_assert(!git_fs_path_isdir("testrepo/a"));
assert_on_branch(g_repo, "subtrees");
@@ -216,11 +216,11 @@ void test_checkout_tree__can_remove_untracked(void)
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_REMOVE_UNTRACKED;
cl_git_mkfile("testrepo/untracked_file", "as you wish");
- cl_assert(git_path_isfile("testrepo/untracked_file"));
+ cl_assert(git_fs_path_isfile("testrepo/untracked_file"));
cl_git_pass(git_checkout_head(g_repo, &opts));
- cl_assert(!git_path_isfile("testrepo/untracked_file"));
+ cl_assert(!git_fs_path_isfile("testrepo/untracked_file"));
}
void test_checkout_tree__can_remove_ignored(void)
@@ -237,11 +237,11 @@ void test_checkout_tree__can_remove_ignored(void)
cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "ignored_file"));
cl_assert_equal_i(1, ignored);
- cl_assert(git_path_isfile("testrepo/ignored_file"));
+ cl_assert(git_fs_path_isfile("testrepo/ignored_file"));
cl_git_pass(git_checkout_head(g_repo, &opts));
- cl_assert(!git_path_isfile("testrepo/ignored_file"));
+ cl_assert(!git_fs_path_isfile("testrepo/ignored_file"));
}
static int checkout_tree_with_blob_ignored_in_workdir(int strategy, bool isdir)
@@ -264,12 +264,12 @@ static int checkout_tree_with_blob_ignored_in_workdir(int strategy, bool isdir)
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir"));
- cl_assert(git_path_isfile("testrepo/README"));
- cl_assert(git_path_isfile("testrepo/branch_file.txt"));
- cl_assert(git_path_isfile("testrepo/new.txt"));
- cl_assert(git_path_isfile("testrepo/a/b.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/README"));
+ cl_assert(git_fs_path_isfile("testrepo/branch_file.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/new.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/a/b.txt"));
- cl_assert(!git_path_isdir("testrepo/ab"));
+ cl_assert(!git_fs_path_isdir("testrepo/ab"));
assert_on_branch(g_repo, "dir");
@@ -285,12 +285,12 @@ static int checkout_tree_with_blob_ignored_in_workdir(int strategy, bool isdir)
cl_git_mkfile("testrepo/ab/4.txt/file2.txt", "foo bar foo");
cl_git_mkfile("testrepo/ab/4.txt/file3.txt", "inky blinky pinky clyde");
- cl_assert(git_path_isdir("testrepo/ab/4.txt"));
+ cl_assert(git_fs_path_isdir("testrepo/ab/4.txt"));
} else {
cl_must_pass(p_mkdir("testrepo/ab", 0777));
cl_git_mkfile("testrepo/ab/4.txt", "as you wish");
- cl_assert(git_path_isfile("testrepo/ab/4.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/ab/4.txt"));
}
cl_git_pass(git_ignore_add_rule(g_repo, "ab/4.txt\n"));
@@ -324,7 +324,7 @@ void test_checkout_tree__can_overwrite_ignored_by_default(void)
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees"));
- cl_assert(git_path_isfile("testrepo/ab/4.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/ab/4.txt"));
assert_on_branch(g_repo, "subtrees");
}
@@ -345,7 +345,7 @@ void test_checkout_tree__can_overwrite_ignored_folder_by_default(void)
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees"));
- cl_assert(git_path_isfile("testrepo/ab/4.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/ab/4.txt"));
assert_on_branch(g_repo, "subtrees");
@@ -364,7 +364,7 @@ void test_checkout_tree__can_update_only(void)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_checkout_head(g_repo, &opts));
- cl_assert(!git_path_isdir("testrepo/a"));
+ cl_assert(!git_fs_path_isdir("testrepo/a"));
check_file_contents_nocr("testrepo/branch_file.txt", "hi\nbye!\n");
@@ -384,7 +384,7 @@ void test_checkout_tree__can_update_only(void)
* the test_checkout_tree__can_switch_branches test), but with
* UPDATE_ONLY it will not have been created.
*/
- cl_assert(!git_path_isdir("testrepo/a"));
+ cl_assert(!git_fs_path_isdir("testrepo/a"));
/* but this file still should have been updated */
check_file_contents_nocr("testrepo/branch_file.txt", "hi\n");
@@ -410,10 +410,10 @@ void test_checkout_tree__can_checkout_with_pattern(void)
git_object_free(g_object);
g_object = NULL;
- cl_assert(git_path_exists("testrepo/README"));
- cl_assert(!git_path_exists("testrepo/branch_file.txt"));
- cl_assert(!git_path_exists("testrepo/link_to_new.txt"));
- cl_assert(!git_path_exists("testrepo/new.txt"));
+ cl_assert(git_fs_path_exists("testrepo/README"));
+ cl_assert(!git_fs_path_exists("testrepo/branch_file.txt"));
+ cl_assert(!git_fs_path_exists("testrepo/link_to_new.txt"));
+ cl_assert(!git_fs_path_exists("testrepo/new.txt"));
/* now to a narrow patterned checkout */
@@ -425,10 +425,10 @@ void test_checkout_tree__can_checkout_with_pattern(void)
cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
- cl_assert(git_path_exists("testrepo/README"));
- cl_assert(!git_path_exists("testrepo/branch_file.txt"));
- cl_assert(git_path_exists("testrepo/link_to_new.txt"));
- cl_assert(git_path_exists("testrepo/new.txt"));
+ cl_assert(git_fs_path_exists("testrepo/README"));
+ cl_assert(!git_fs_path_exists("testrepo/branch_file.txt"));
+ cl_assert(git_fs_path_exists("testrepo/link_to_new.txt"));
+ cl_assert(git_fs_path_exists("testrepo/new.txt"));
}
void test_checkout_tree__pathlist_checkout_ignores_non_matches(void)
@@ -445,10 +445,10 @@ void test_checkout_tree__pathlist_checkout_ignores_non_matches(void)
cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/master"));
- cl_assert(git_path_exists("testrepo/README"));
- cl_assert(git_path_exists("testrepo/branch_file.txt"));
- cl_assert(git_path_exists("testrepo/link_to_new.txt"));
- cl_assert(git_path_exists("testrepo/new.txt"));
+ cl_assert(git_fs_path_exists("testrepo/README"));
+ cl_assert(git_fs_path_exists("testrepo/branch_file.txt"));
+ cl_assert(git_fs_path_exists("testrepo/link_to_new.txt"));
+ cl_assert(git_fs_path_exists("testrepo/new.txt"));
git_object_free(g_object);
cl_git_pass(git_revparse_single(&g_object, g_repo, "8496071c1b46c854b31185ea97743be6a8774479"));
@@ -460,10 +460,10 @@ void test_checkout_tree__pathlist_checkout_ignores_non_matches(void)
cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
- cl_assert(git_path_exists("testrepo/README"));
- cl_assert(!git_path_exists("testrepo/branch_file.txt"));
- cl_assert(!git_path_exists("testrepo/link_to_new.txt"));
- cl_assert(git_path_exists("testrepo/new.txt"));
+ cl_assert(git_fs_path_exists("testrepo/README"));
+ cl_assert(!git_fs_path_exists("testrepo/branch_file.txt"));
+ cl_assert(!git_fs_path_exists("testrepo/link_to_new.txt"));
+ cl_assert(git_fs_path_exists("testrepo/new.txt"));
}
void test_checkout_tree__can_disable_pattern_match(void)
@@ -484,7 +484,7 @@ void test_checkout_tree__can_disable_pattern_match(void)
git_object_free(g_object);
g_object = NULL;
- cl_assert(!git_path_isfile("testrepo/branch_file.txt"));
+ cl_assert(!git_fs_path_isfile("testrepo/branch_file.txt"));
/* now to a narrow patterned checkout, but disable pattern */
@@ -498,7 +498,7 @@ void test_checkout_tree__can_disable_pattern_match(void)
cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
- cl_assert(!git_path_isfile("testrepo/branch_file.txt"));
+ cl_assert(!git_fs_path_isfile("testrepo/branch_file.txt"));
/* let's try that again, but allow the pattern match */
@@ -506,7 +506,7 @@ void test_checkout_tree__can_disable_pattern_match(void)
cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
- cl_assert(git_path_isfile("testrepo/branch_file.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/branch_file.txt"));
}
void assert_conflict(
@@ -623,7 +623,7 @@ void test_checkout_tree__donot_update_deleted_file_by_default(void)
cl_git_pass(git_index_remove_bypath(index ,"branch_file.txt"));
cl_git_pass(git_index_write(index));
- cl_assert(!git_path_exists("testrepo/branch_file.txt"));
+ cl_assert(!git_fs_path_exists("testrepo/branch_file.txt"));
cl_git_pass(git_oid_fromstr(&new_id, "099fabac3a9ea935598528c27f866e34089c2eff"));
cl_git_pass(git_commit_lookup(&new_commit, g_repo, &new_id));
@@ -686,16 +686,16 @@ void test_checkout_tree__can_cancel_checkout_from_notify(void)
opts.notify_payload = &ca;
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
- cl_assert(!git_path_exists("testrepo/new.txt"));
+ cl_assert(!git_fs_path_exists("testrepo/new.txt"));
cl_git_fail_with(git_checkout_tree(g_repo, obj, &opts), -5555);
- cl_assert(!git_path_exists("testrepo/new.txt"));
+ cl_assert(!git_fs_path_exists("testrepo/new.txt"));
/* on case-insensitive FS = a/b.txt, branch_file.txt, new.txt */
/* on case-sensitive FS = README, then above */
- if (git_path_exists("testrepo/.git/CoNfIg")) /* case insensitive */
+ if (git_fs_path_exists("testrepo/.git/CoNfIg")) /* case insensitive */
cl_assert_equal_i(3, ca.count);
else
cl_assert_equal_i(4, ca.count);
@@ -707,9 +707,9 @@ void test_checkout_tree__can_cancel_checkout_from_notify(void)
cl_git_fail_with(git_checkout_tree(g_repo, obj, &opts), 123);
- cl_assert(!git_path_exists("testrepo/new.txt"));
+ cl_assert(!git_fs_path_exists("testrepo/new.txt"));
- if (git_path_exists("testrepo/.git/CoNfIg")) /* case insensitive */
+ if (git_fs_path_exists("testrepo/.git/CoNfIg")) /* case insensitive */
cl_assert_equal_i(4, ca.count);
else
cl_assert_equal_i(1, ca.count);
@@ -799,7 +799,7 @@ void test_checkout_tree__can_write_to_empty_dirs(void)
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
- cl_assert(git_path_isfile("testrepo/a/b.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/a/b.txt"));
git_object_free(obj);
}
@@ -818,7 +818,7 @@ void test_checkout_tree__fails_when_dir_in_use(void)
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
- cl_assert(git_path_isfile("testrepo/a/b.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/a/b.txt"));
git_object_free(obj);
@@ -831,7 +831,7 @@ void test_checkout_tree__fails_when_dir_in_use(void)
cl_git_pass(p_chdir("../.."));
- cl_assert(git_path_is_empty_dir("testrepo/a"));
+ cl_assert(git_fs_path_is_empty_dir("testrepo/a"));
git_object_free(obj);
#endif
@@ -852,7 +852,7 @@ void test_checkout_tree__can_continue_when_dir_in_use(void)
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
- cl_assert(git_path_isfile("testrepo/a/b.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/a/b.txt"));
git_object_free(obj);
@@ -865,7 +865,7 @@ void test_checkout_tree__can_continue_when_dir_in_use(void)
cl_git_pass(p_chdir("../.."));
- cl_assert(git_path_is_empty_dir("testrepo/a"));
+ cl_assert(git_fs_path_is_empty_dir("testrepo/a"));
git_object_free(obj);
#endif
@@ -896,7 +896,7 @@ void test_checkout_tree__target_directory_from_bare(void)
cl_git_fail(git_checkout_tree(g_repo, g_object, &opts));
opts.target_directory = "alternative";
- cl_assert(!git_path_isdir("alternative"));
+ cl_assert(!git_fs_path_isdir("alternative"));
cl_git_pass(git_checkout_tree(g_repo, g_object, &opts));
@@ -923,12 +923,12 @@ void test_checkout_tree__extremely_long_file_name(void)
cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
sprintf(path, "testrepo/%s.txt", longname);
- cl_assert(git_path_exists(path));
+ cl_assert(git_fs_path_exists(path));
git_object_free(g_object);
cl_git_pass(git_revparse_single(&g_object, g_repo, "master"));
cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
- cl_assert(!git_path_exists(path));
+ cl_assert(!git_fs_path_exists(path));
}
static void create_conflict(const char *path)
@@ -1138,7 +1138,7 @@ void test_checkout_tree__removes_conflicts(void)
cl_assert_equal_p(NULL, git_index_get_bypath(index, "other.txt", 2));
cl_assert_equal_p(NULL, git_index_get_bypath(index, "other.txt", 3));
- cl_assert(!git_path_exists("testrepo/other.txt"));
+ cl_assert(!git_fs_path_exists("testrepo/other.txt"));
git_commit_free(commit);
git_index_free(index);
@@ -1183,7 +1183,7 @@ void test_checkout_tree__removes_conflicts_only_by_pathscope(void)
cl_assert(git_index_get_bypath(index, "other.txt", 2) != NULL);
cl_assert(git_index_get_bypath(index, "other.txt", 3) != NULL);
- cl_assert(git_path_exists("testrepo/other.txt"));
+ cl_assert(git_fs_path_exists("testrepo/other.txt"));
git_commit_free(commit);
git_index_free(index);
@@ -1214,8 +1214,8 @@ void test_checkout_tree__case_changing_rename(void)
cl_git_pass(git_checkout_tree(g_repo, (git_object *)dir_commit, &opts));
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir"));
- cl_assert(git_path_isfile("testrepo/README"));
- case_sensitive = !git_path_isfile("testrepo/readme");
+ cl_assert(git_fs_path_isfile("testrepo/README"));
+ case_sensitive = !git_fs_path_isfile("testrepo/readme");
cl_assert(index_entry = git_index_get_bypath(index, "README", 0));
cl_assert_equal_s("README", index_entry->path);
@@ -1235,9 +1235,9 @@ void test_checkout_tree__case_changing_rename(void)
cl_git_pass(git_commit_create(&commit_id, g_repo, "refs/heads/dir", signature, signature, NULL, "case-changing rename", tree, 1, (const git_commit **)&dir_commit));
- cl_assert(git_path_isfile("testrepo/readme"));
+ cl_assert(git_fs_path_isfile("testrepo/readme"));
if (case_sensitive)
- cl_assert(!git_path_isfile("testrepo/README"));
+ cl_assert(!git_fs_path_isfile("testrepo/README"));
cl_assert(index_entry = git_index_get_bypath(index, "readme", 0));
cl_assert_equal_s("readme", index_entry->path);
@@ -1253,9 +1253,9 @@ void test_checkout_tree__case_changing_rename(void)
assert_on_branch(g_repo, "master");
- cl_assert(git_path_isfile("testrepo/README"));
+ cl_assert(git_fs_path_isfile("testrepo/README"));
if (case_sensitive)
- cl_assert(!git_path_isfile("testrepo/readme"));
+ cl_assert(!git_fs_path_isfile("testrepo/readme"));
cl_assert(index_entry = git_index_get_bypath(index, "README", 0));
cl_assert_equal_s("README", index_entry->path);
@@ -1366,13 +1366,13 @@ void test_checkout_tree__can_not_update_index(void)
cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts));
- cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/"));
+ cl_assert_equal_i(false, git_fs_path_isdir("./testrepo/ab/"));
cl_git_pass(git_revparse_single(&g_object, g_repo, "subtrees"));
cl_git_pass(git_checkout_tree(g_repo, g_object, &opts));
- cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/2.txt"));
+ cl_assert_equal_i(true, git_fs_path_isfile("./testrepo/ab/de/2.txt"));
cl_git_pass(git_status_file(&status, g_repo, "ab/de/2.txt"));
cl_assert_equal_i(GIT_STATUS_WT_NEW, status);
@@ -1403,13 +1403,13 @@ void test_checkout_tree__can_update_but_not_write_index(void)
cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts));
- cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/"));
+ cl_assert_equal_i(false, git_fs_path_isdir("./testrepo/ab/"));
cl_git_pass(git_revparse_single(&g_object, g_repo, "subtrees"));
cl_git_pass(git_checkout_tree(g_repo, g_object, &opts));
- cl_assert_equal_i(true, git_path_isfile("./testrepo/ab/de/2.txt"));
+ cl_assert_equal_i(true, git_fs_path_isfile("./testrepo/ab/de/2.txt"));
cl_git_pass(git_status_file(&status, g_repo, "ab/de/2.txt"));
cl_assert_equal_i(GIT_STATUS_INDEX_NEW, status);
@@ -1450,15 +1450,15 @@ void test_checkout_tree__safe_proceeds_if_no_index(void)
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees"));
- cl_assert(git_path_isfile("testrepo/README"));
- cl_assert(git_path_isfile("testrepo/branch_file.txt"));
- cl_assert(git_path_isfile("testrepo/new.txt"));
- cl_assert(git_path_isfile("testrepo/ab/4.txt"));
- cl_assert(git_path_isfile("testrepo/ab/c/3.txt"));
- cl_assert(git_path_isfile("testrepo/ab/de/2.txt"));
- cl_assert(git_path_isfile("testrepo/ab/de/fgh/1.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/README"));
+ cl_assert(git_fs_path_isfile("testrepo/branch_file.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/new.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/ab/4.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/ab/c/3.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/ab/de/2.txt"));
+ cl_assert(git_fs_path_isfile("testrepo/ab/de/fgh/1.txt"));
- cl_assert(!git_path_isdir("testrepo/a"));
+ cl_assert(!git_fs_path_isdir("testrepo/a"));
assert_on_branch(g_repo, "subtrees");
@@ -1650,7 +1650,7 @@ void test_checkout_tree__dry_run(void)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_checkout_head(g_repo, &opts));
- cl_assert(!git_path_isdir("testrepo/a"));
+ cl_assert(!git_fs_path_isdir("testrepo/a"));
check_file_contents_nocr("testrepo/branch_file.txt", "hi\nbye!\n");
@@ -1673,7 +1673,7 @@ void test_checkout_tree__dry_run(void)
/* these normally would have been created and updated, but with
* DRY_RUN they will be unchanged.
*/
- cl_assert(!git_path_isdir("testrepo/a"));
+ cl_assert(!git_fs_path_isdir("testrepo/a"));
check_file_contents_nocr("testrepo/branch_file.txt", "hi\nbye!\n");
/* check that notify callback was invoked */
diff --git a/tests/checkout/typechange.c b/tests/checkout/typechange.c
index 205ce657f..b888843f0 100644
--- a/tests/checkout/typechange.c
+++ b/tests/checkout/typechange.c
@@ -76,12 +76,12 @@ void test_checkout_typechange__cleanup(void)
static void assert_file_exists(const char *path)
{
- cl_assert_(git_path_isfile(path), path);
+ cl_assert_(git_fs_path_isfile(path), path);
}
static void assert_dir_exists(const char *path)
{
- cl_assert_(git_path_isdir(path), path);
+ cl_assert_(git_fs_path_isdir(path), path);
}
static void assert_workdir_matches_tree(
@@ -126,7 +126,7 @@ static void assert_workdir_matches_tree(
/* because of cross-platform, don't confirm exec bit yet */
break;
case GIT_FILEMODE_LINK:
- cl_assert_(git_path_exists(path.ptr), path.ptr);
+ cl_assert_(git_fs_path_exists(path.ptr), path.ptr);
/* because of cross-platform, don't confirm link yet */
break;
default:
@@ -163,19 +163,19 @@ void test_checkout_typechange__checkout_typechanges_safe(void)
git_object_free(obj);
if (!g_typechange_empty[i]) {
- cl_assert(git_path_isdir("typechanges"));
- cl_assert(git_path_exists("typechanges/a"));
- cl_assert(git_path_exists("typechanges/b"));
- cl_assert(git_path_exists("typechanges/c"));
- cl_assert(git_path_exists("typechanges/d"));
- cl_assert(git_path_exists("typechanges/e"));
+ cl_assert(git_fs_path_isdir("typechanges"));
+ cl_assert(git_fs_path_exists("typechanges/a"));
+ cl_assert(git_fs_path_exists("typechanges/b"));
+ cl_assert(git_fs_path_exists("typechanges/c"));
+ cl_assert(git_fs_path_exists("typechanges/d"));
+ cl_assert(git_fs_path_exists("typechanges/e"));
} else {
- cl_assert(git_path_isdir("typechanges"));
- cl_assert(!git_path_exists("typechanges/a"));
- cl_assert(!git_path_exists("typechanges/b"));
- cl_assert(!git_path_exists("typechanges/c"));
- cl_assert(!git_path_exists("typechanges/d"));
- cl_assert(!git_path_exists("typechanges/e"));
+ cl_assert(git_fs_path_isdir("typechanges"));
+ cl_assert(!git_fs_path_exists("typechanges/a"));
+ cl_assert(!git_fs_path_exists("typechanges/b"));
+ cl_assert(!git_fs_path_exists("typechanges/c"));
+ cl_assert(!git_fs_path_exists("typechanges/d"));
+ cl_assert(!git_fs_path_exists("typechanges/e"));
}
}
}
@@ -293,12 +293,12 @@ void test_checkout_typechange__checkout_with_conflicts(void)
GIT_CHECKOUT_FORCE | GIT_CHECKOUT_REMOVE_UNTRACKED;
memset(&cts, 0, sizeof(cts));
- cl_assert(git_path_exists("typechanges/untracked"));
+ cl_assert(git_fs_path_exists("typechanges/untracked"));
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
cl_assert_equal_i(0, cts.conflicts);
- cl_assert(!git_path_exists("typechanges/untracked"));
+ cl_assert(!git_fs_path_exists("typechanges/untracked"));
cl_git_pass(
git_repository_set_head_detached(g_repo, git_object_id(obj)));
diff --git a/tests/cherrypick/workdir.c b/tests/cherrypick/workdir.c
index f7765f2c2..868b9d5ff 100644
--- a/tests/cherrypick/workdir.c
+++ b/tests/cherrypick/workdir.c
@@ -71,8 +71,8 @@ void test_cherrypick_workdir__automerge(void)
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick(repo, commit, NULL));
- cl_assert(git_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
- cl_assert(git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
+ cl_assert(git_fs_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
+ cl_assert(git_fs_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
cl_git_pass(git_index_write_tree(&cherrypicked_tree_oid, repo_index));
cl_git_pass(git_tree_lookup(&cherrypicked_tree, repo, &cherrypicked_tree_oid));
@@ -114,7 +114,7 @@ void test_cherrypick_workdir__empty_result(void)
/* Create an untracked file that should not conflict */
cl_git_mkfile(TEST_REPO_PATH "/file4.txt", "");
- cl_assert(git_path_exists(TEST_REPO_PATH "/file4.txt"));
+ cl_assert(git_fs_path_exists(TEST_REPO_PATH "/file4.txt"));
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
@@ -160,8 +160,8 @@ void test_cherrypick_workdir__conflicts(void)
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherrypick(repo, commit, NULL));
- cl_assert(git_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
- cl_assert(git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
+ cl_assert(git_fs_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
+ cl_assert(git_fs_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
cl_assert(merge_test_index(repo_index, merge_index_entries, 7));
@@ -373,8 +373,8 @@ void test_cherrypick_workdir__nonmerge_fails_mainline_specified(void)
opts.mainline = 1;
cl_must_fail(git_cherrypick(repo, commit, &opts));
- cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
- cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
+ cl_assert(!git_fs_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
+ cl_assert(!git_fs_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
git_reference_free(head);
git_commit_free(commit);
@@ -396,8 +396,8 @@ void test_cherrypick_workdir__merge_fails_without_mainline_specified(void)
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_must_fail(git_cherrypick(repo, commit, NULL));
- cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
- cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
+ cl_assert(!git_fs_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
+ cl_assert(!git_fs_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
git_commit_free(commit);
git_commit_free(head);
diff --git a/tests/clar_libgit2.c b/tests/clar_libgit2.c
index adea597e3..55a09d111 100644
--- a/tests/clar_libgit2.c
+++ b/tests/clar_libgit2.c
@@ -1,6 +1,6 @@
#include "clar_libgit2.h"
#include "posix.h"
-#include "path.h"
+#include "fs_path.h"
#include "git2/sys/repository.h"
void cl_git_report_failure(
@@ -281,7 +281,7 @@ const char* cl_git_path_url(const char *path)
git_str path_buf = GIT_STR_INIT;
git_str url_buf = GIT_STR_INIT;
- cl_git_pass(git_path_prettify_dir(&path_buf, path, NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&path_buf, path, NULL));
cl_git_pass(git_str_puts(&url_buf, "file://"));
#ifdef GIT_WIN32
@@ -336,9 +336,9 @@ const char *cl_git_sandbox_path(int is_dir, ...)
}
va_end(arg);
- cl_git_pass(git_path_prettify(&buf, buf.ptr, NULL));
+ cl_git_pass(git_fs_path_prettify(&buf, buf.ptr, NULL));
if (is_dir)
- git_path_to_dir(&buf);
+ git_fs_path_to_dir(&buf);
/* make sure we won't truncate */
cl_assert(git_str_len(&buf) < sizeof(_temp));
@@ -359,8 +359,8 @@ static int remove_placeholders_recurs(void *_data, git_str *path)
remove_data *data = (remove_data *)_data;
size_t pathlen;
- if (git_path_isdir(path->ptr) == true)
- return git_path_direach(path, 0, remove_placeholders_recurs, data);
+ if (git_fs_path_isdir(path->ptr) == true)
+ return git_fs_path_direach(path, 0, remove_placeholders_recurs, data);
pathlen = path->size;
@@ -382,7 +382,7 @@ int cl_git_remove_placeholders(const char *directory_path, const char *filename)
remove_data data;
git_str buffer = GIT_STR_INIT;
- if (git_path_isdir(directory_path) == false)
+ if (git_fs_path_isdir(directory_path) == false)
return -1;
if (git_str_sets(&buffer, directory_path) < 0)
@@ -570,9 +570,9 @@ void cl_fake_home(void)
cl_set_cleanup(cl_fake_home_cleanup, NULL);
- if (!git_path_exists("home"))
+ if (!git_fs_path_exists("home"))
cl_must_pass(p_mkdir("home", 0777));
- cl_git_pass(git_path_prettify(&path, "home", NULL));
+ cl_git_pass(git_fs_path_prettify(&path, "home", NULL));
cl_git_pass(git_libgit2_opts(
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr));
git_str_dispose(&path);
@@ -584,7 +584,7 @@ void cl_sandbox_set_search_path_defaults(void)
git_str_joinpath(&path, clar_sandbox_path(), "__config");
- if (!git_path_exists(path.ptr))
+ if (!git_fs_path_exists(path.ptr))
cl_must_pass(p_mkdir(path.ptr, 0777));
git_libgit2_opts(
diff --git a/tests/clone/nonetwork.c b/tests/clone/nonetwork.c
index 7625a2183..c3515b53f 100644
--- a/tests/clone/nonetwork.c
+++ b/tests/clone/nonetwork.c
@@ -51,10 +51,10 @@ void test_clone_nonetwork__bad_urls(void)
{
/* Clone should clean up the mess if the URL isn't a git repository */
cl_git_fail(git_clone(&g_repo, "not_a_repo", "./foo", &g_options));
- cl_assert(!git_path_exists("./foo"));
+ cl_assert(!git_fs_path_exists("./foo"));
g_options.bare = true;
cl_git_fail(git_clone(&g_repo, "not_a_repo", "./foo", &g_options));
- cl_assert(!git_path_exists("./foo"));
+ cl_assert(!git_fs_path_exists("./foo"));
cl_git_fail(git_clone(&g_repo, "git://example.com:asdf", "./foo", &g_options));
cl_git_fail(git_clone(&g_repo, "https://example.com:asdf/foo", "./foo", &g_options));
@@ -70,12 +70,12 @@ void test_clone_nonetwork__do_not_clean_existing_directory(void)
* Should clean up entries it creates. */
p_mkdir("./foo", GIT_DIR_MODE);
cl_git_fail(git_clone(&g_repo, "not_a_repo", "./foo", &g_options));
- cl_assert(git_path_is_empty_dir("./foo"));
+ cl_assert(git_fs_path_is_empty_dir("./foo"));
/* Try again with a bare repository. */
g_options.bare = true;
cl_git_fail(git_clone(&g_repo, "not_a_repo", "./foo", &g_options));
- cl_assert(git_path_is_empty_dir("./foo"));
+ cl_assert(git_fs_path_is_empty_dir("./foo"));
}
void test_clone_nonetwork__local(void)
@@ -151,7 +151,7 @@ void test_clone_nonetwork__can_prevent_the_checkout_of_a_standard_repo(void)
cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
cl_git_pass(git_str_joinpath(&path, git_repository_workdir(g_repo), "master.txt"));
- cl_assert_equal_i(false, git_path_isfile(git_str_cstr(&path)));
+ cl_assert_equal_i(false, git_fs_path_isfile(git_str_cstr(&path)));
git_str_dispose(&path);
}
@@ -168,7 +168,7 @@ void test_clone_nonetwork__can_checkout_given_branch(void)
cl_git_pass(git_repository_head(&g_ref, g_repo));
cl_assert_equal_s(git_reference_name(g_ref), "refs/heads/test");
- cl_assert(git_path_exists("foo/readme.txt"));
+ cl_assert(git_fs_path_exists("foo/readme.txt"));
cl_git_pass(git_reference_lookup(&remote_head, g_repo, "refs/remotes/origin/HEAD"));
cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(remote_head));
@@ -196,7 +196,7 @@ void test_clone_nonetwork__can_cancel_clone_in_fetch(void)
-54321);
cl_assert(!g_repo);
- cl_assert(!git_path_exists("foo/readme.txt"));
+ cl_assert(!git_fs_path_exists("foo/readme.txt"));
}
static int clone_cancel_checkout_cb(
@@ -227,7 +227,7 @@ void test_clone_nonetwork__can_cancel_clone_in_checkout(void)
-12345);
cl_assert(!g_repo);
- cl_assert(!git_path_exists("foo/readme.txt"));
+ cl_assert(!git_fs_path_exists("foo/readme.txt"));
}
void test_clone_nonetwork__can_detached_head(void)
diff --git a/tests/config/global.c b/tests/config/global.c
index d59c39fa2..5aba4eec6 100644
--- a/tests/config/global.c
+++ b/tests/config/global.c
@@ -6,17 +6,17 @@ void test_config_global__initialize(void)
git_str path = GIT_STR_INIT;
cl_git_pass(git_futils_mkdir_r("home", 0777));
- cl_git_pass(git_path_prettify(&path, "home", NULL));
+ cl_git_pass(git_fs_path_prettify(&path, "home", NULL));
cl_git_pass(git_libgit2_opts(
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr));
cl_git_pass(git_futils_mkdir_r("xdg/git", 0777));
- cl_git_pass(git_path_prettify(&path, "xdg/git", NULL));
+ cl_git_pass(git_fs_path_prettify(&path, "xdg/git", NULL));
cl_git_pass(git_libgit2_opts(
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_XDG, path.ptr));
cl_git_pass(git_futils_mkdir_r("etc", 0777));
- cl_git_pass(git_path_prettify(&path, "etc", NULL));
+ cl_git_pass(git_fs_path_prettify(&path, "etc", NULL));
cl_git_pass(git_libgit2_opts(
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_SYSTEM, path.ptr));
@@ -141,7 +141,7 @@ void test_config_global__open_programdata(void)
cl_git_pass(git_libgit2_opts(GIT_OPT_GET_SEARCH_PATH,
GIT_CONFIG_LEVEL_PROGRAMDATA, &dir_path));
- if (!git_path_isdir(dir_path.ptr))
+ if (!git_fs_path_isdir(dir_path.ptr))
cl_git_pass(p_mkdir(dir_path.ptr, 0777));
cl_git_pass(git_str_joinpath(&config_path, dir_path.ptr, "config"));
diff --git a/tests/config/read.c b/tests/config/read.c
index 77f8a1262..3c96f8519 100644
--- a/tests/config/read.c
+++ b/tests/config/read.c
@@ -1,5 +1,5 @@
#include "clar_libgit2.h"
-#include "path.h"
+#include "fs_path.h"
static git_buf buf = GIT_BUF_INIT;
@@ -705,11 +705,11 @@ void test_config_read__path(void)
git_str expected_path = GIT_STR_INIT;
cl_git_pass(p_mkdir("fakehome", 0777));
- cl_git_pass(git_path_prettify(&home_path, "fakehome", NULL));
+ cl_git_pass(git_fs_path_prettify(&home_path, "fakehome", NULL));
cl_git_pass(git_libgit2_opts(GIT_OPT_GET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, &old_path));
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, home_path.ptr));
cl_git_mkfile("./testconfig", "[some]\n path = ~/somefile");
- cl_git_pass(git_path_join_unrooted(&expected_path, "somefile", home_path.ptr, NULL));
+ cl_git_pass(git_fs_path_join_unrooted(&expected_path, "somefile", home_path.ptr, NULL));
cl_git_pass(git_config_open_ondisk(&cfg, "./testconfig"));
cl_git_pass(git_config_get_path(&path, cfg, "some.path"));
@@ -717,7 +717,7 @@ void test_config_read__path(void)
git_buf_dispose(&path);
cl_git_mkfile("./testconfig", "[some]\n path = ~/");
- cl_git_pass(git_path_join_unrooted(&expected_path, "", home_path.ptr, NULL));
+ cl_git_pass(git_fs_path_join_unrooted(&expected_path, "", home_path.ptr, NULL));
cl_git_pass(git_config_get_path(&path, cfg, "some.path"));
cl_assert_equal_s(expected_path.ptr, path.ptr);
diff --git a/tests/config/readonly.c b/tests/config/readonly.c
index 5d544b8cb..a8901e394 100644
--- a/tests/config/readonly.c
+++ b/tests/config/readonly.c
@@ -25,7 +25,7 @@ void test_config_readonly__writing_to_readonly_fails(void)
cl_git_pass(git_config_add_backend(cfg, backend, GIT_CONFIG_LEVEL_GLOBAL, NULL, 0));
cl_git_fail_with(GIT_ENOTFOUND, git_config_set_string(cfg, "foo.bar", "baz"));
- cl_assert(!git_path_exists("global"));
+ cl_assert(!git_fs_path_exists("global"));
}
void test_config_readonly__writing_to_cfg_with_rw_precedence_succeeds(void)
@@ -41,8 +41,8 @@ void test_config_readonly__writing_to_cfg_with_rw_precedence_succeeds(void)
cl_git_pass(git_config_set_string(cfg, "foo.bar", "baz"));
- cl_assert(git_path_exists("local"));
- cl_assert(!git_path_exists("global"));
+ cl_assert(git_fs_path_exists("local"));
+ cl_assert(!git_fs_path_exists("global"));
cl_git_pass(p_unlink("local"));
}
@@ -59,7 +59,7 @@ void test_config_readonly__writing_to_cfg_with_ro_precedence_succeeds(void)
cl_git_pass(git_config_set_string(cfg, "foo.bar", "baz"));
- cl_assert(!git_path_exists("local"));
- cl_assert(git_path_exists("global"));
+ cl_assert(!git_fs_path_exists("local"));
+ cl_assert(git_fs_path_exists("global"));
cl_git_pass(p_unlink("global"));
}
diff --git a/tests/config/stress.c b/tests/config/stress.c
index 7ec274b18..c823284ff 100644
--- a/tests/config/stress.c
+++ b/tests/config/stress.c
@@ -30,7 +30,7 @@ void test_config_stress__dont_break_on_invalid_input(void)
{
git_config *config;
- cl_assert(git_path_exists(TEST_CONFIG));
+ cl_assert(git_fs_path_exists(TEST_CONFIG));
cl_git_pass(git_config_open_ondisk(&config, TEST_CONFIG));
cl_git_pass(git_config_get_string_buf(&buf, config, "color.ui"));
@@ -72,7 +72,7 @@ void test_config_stress__escape_subsection_names(void)
{
git_config *config;
- cl_assert(git_path_exists("git-test-config"));
+ cl_assert(git_fs_path_exists("git-test-config"));
cl_git_pass(git_config_open_ondisk(&config, TEST_CONFIG));
cl_git_pass(git_config_set_string(config, "some.sec\\tion.other", "foo"));
@@ -90,7 +90,7 @@ void test_config_stress__trailing_backslash(void)
git_config *config;
const char *path = "C:\\iam\\some\\windows\\path\\";
- cl_assert(git_path_exists("git-test-config"));
+ cl_assert(git_fs_path_exists("git-test-config"));
cl_git_pass(git_config_open_ondisk(&config, TEST_CONFIG));
cl_git_pass(git_config_set_string(config, "windows.path", path));
git_config_free(config);
diff --git a/tests/core/copy.c b/tests/core/copy.c
index d31274808..2b90fb6bf 100644
--- a/tests/core/copy.c
+++ b/tests/core/copy.c
@@ -12,7 +12,7 @@ void test_core_copy__file(void)
cl_git_pass(git_futils_cp("copy_me", "copy_me_two", 0664));
- cl_git_pass(git_path_lstat("copy_me_two", &st));
+ cl_git_pass(git_fs_path_lstat("copy_me_two", &st));
cl_assert(S_ISREG(st.st_mode));
cl_assert(strlen(content) == (size_t)st.st_size);
@@ -27,7 +27,7 @@ void test_core_copy__file_in_dir(void)
cl_git_pass(git_futils_mkdir("an_dir/in_a_dir", 0775, GIT_MKDIR_PATH));
cl_git_mkfile("an_dir/in_a_dir/copy_me", content);
- cl_assert(git_path_isdir("an_dir"));
+ cl_assert(git_fs_path_isdir("an_dir"));
cl_git_pass(git_futils_mkpath2file
("an_dir/second_dir/and_more/copy_me_two", 0775));
@@ -37,12 +37,12 @@ void test_core_copy__file_in_dir(void)
"an_dir/second_dir/and_more/copy_me_two",
0664));
- cl_git_pass(git_path_lstat("an_dir/second_dir/and_more/copy_me_two", &st));
+ cl_git_pass(git_fs_path_lstat("an_dir/second_dir/and_more/copy_me_two", &st));
cl_assert(S_ISREG(st.st_mode));
cl_assert(strlen(content) == (size_t)st.st_size);
cl_git_pass(git_futils_rmdir_r("an_dir", NULL, GIT_RMDIR_REMOVE_FILES));
- cl_assert(!git_path_isdir("an_dir"));
+ cl_assert(!git_fs_path_isdir("an_dir"));
}
void assert_hard_link(const char *path)
@@ -50,7 +50,7 @@ void assert_hard_link(const char *path)
/* we assert this by checking that there's more than one link to the file */
struct stat st;
- cl_assert(git_path_isfile(path));
+ cl_assert(git_fs_path_isfile(path));
cl_git_pass(p_stat(path, &st));
cl_assert(st.st_nlink > 1);
}
@@ -74,73 +74,73 @@ void test_core_copy__tree(void)
cl_assert(p_symlink("../../b/f2", "src/c/d/l1") == 0);
#endif
- cl_assert(git_path_isdir("src"));
- cl_assert(git_path_isdir("src/b"));
- cl_assert(git_path_isdir("src/c/d"));
- cl_assert(git_path_isfile("src/c/d/f4"));
+ cl_assert(git_fs_path_isdir("src"));
+ cl_assert(git_fs_path_isdir("src/b"));
+ cl_assert(git_fs_path_isdir("src/c/d"));
+ cl_assert(git_fs_path_isfile("src/c/d/f4"));
/* copy with no empty dirs, yes links, no dotfiles, no overwrite */
cl_git_pass(
git_futils_cp_r("src", "t1", GIT_CPDIR_COPY_SYMLINKS, 0) );
- cl_assert(git_path_isdir("t1"));
- cl_assert(git_path_isdir("t1/b"));
- cl_assert(git_path_isdir("t1/c"));
- cl_assert(git_path_isdir("t1/c/d"));
- cl_assert(!git_path_isdir("t1/c/e"));
+ cl_assert(git_fs_path_isdir("t1"));
+ cl_assert(git_fs_path_isdir("t1/b"));
+ cl_assert(git_fs_path_isdir("t1/c"));
+ cl_assert(git_fs_path_isdir("t1/c/d"));
+ cl_assert(!git_fs_path_isdir("t1/c/e"));
- cl_assert(git_path_isfile("t1/f1"));
- cl_assert(git_path_isfile("t1/b/f2"));
- cl_assert(git_path_isfile("t1/c/f3"));
- cl_assert(git_path_isfile("t1/c/d/f4"));
- cl_assert(!git_path_isfile("t1/c/d/.f5"));
+ cl_assert(git_fs_path_isfile("t1/f1"));
+ cl_assert(git_fs_path_isfile("t1/b/f2"));
+ cl_assert(git_fs_path_isfile("t1/c/f3"));
+ cl_assert(git_fs_path_isfile("t1/c/d/f4"));
+ cl_assert(!git_fs_path_isfile("t1/c/d/.f5"));
- cl_git_pass(git_path_lstat("t1/c/f3", &st));
+ cl_git_pass(git_fs_path_lstat("t1/c/f3", &st));
cl_assert(S_ISREG(st.st_mode));
cl_assert(strlen(content) == (size_t)st.st_size);
#ifndef GIT_WIN32
- cl_git_pass(git_path_lstat("t1/c/d/l1", &st));
+ cl_git_pass(git_fs_path_lstat("t1/c/d/l1", &st));
cl_assert(S_ISLNK(st.st_mode));
#endif
cl_git_pass(git_futils_rmdir_r("t1", NULL, GIT_RMDIR_REMOVE_FILES));
- cl_assert(!git_path_isdir("t1"));
+ cl_assert(!git_fs_path_isdir("t1"));
/* copy with empty dirs, no links, yes dotfiles, no overwrite */
cl_git_pass(
git_futils_cp_r("src", "t2", GIT_CPDIR_CREATE_EMPTY_DIRS | GIT_CPDIR_COPY_DOTFILES, 0) );
- cl_assert(git_path_isdir("t2"));
- cl_assert(git_path_isdir("t2/b"));
- cl_assert(git_path_isdir("t2/c"));
- cl_assert(git_path_isdir("t2/c/d"));
- cl_assert(git_path_isdir("t2/c/e"));
+ cl_assert(git_fs_path_isdir("t2"));
+ cl_assert(git_fs_path_isdir("t2/b"));
+ cl_assert(git_fs_path_isdir("t2/c"));
+ cl_assert(git_fs_path_isdir("t2/c/d"));
+ cl_assert(git_fs_path_isdir("t2/c/e"));
- cl_assert(git_path_isfile("t2/f1"));
- cl_assert(git_path_isfile("t2/b/f2"));
- cl_assert(git_path_isfile("t2/c/f3"));
- cl_assert(git_path_isfile("t2/c/d/f4"));
- cl_assert(git_path_isfile("t2/c/d/.f5"));
+ cl_assert(git_fs_path_isfile("t2/f1"));
+ cl_assert(git_fs_path_isfile("t2/b/f2"));
+ cl_assert(git_fs_path_isfile("t2/c/f3"));
+ cl_assert(git_fs_path_isfile("t2/c/d/f4"));
+ cl_assert(git_fs_path_isfile("t2/c/d/.f5"));
#ifndef GIT_WIN32
- cl_git_fail(git_path_lstat("t2/c/d/l1", &st));
+ cl_git_fail(git_fs_path_lstat("t2/c/d/l1", &st));
#endif
cl_git_pass(git_futils_rmdir_r("t2", NULL, GIT_RMDIR_REMOVE_FILES));
- cl_assert(!git_path_isdir("t2"));
+ cl_assert(!git_fs_path_isdir("t2"));
#ifndef GIT_WIN32
cl_git_pass(git_futils_cp_r("src", "t3", GIT_CPDIR_CREATE_EMPTY_DIRS | GIT_CPDIR_LINK_FILES, 0));
- cl_assert(git_path_isdir("t3"));
+ cl_assert(git_fs_path_isdir("t3"));
- cl_assert(git_path_isdir("t3"));
- cl_assert(git_path_isdir("t3/b"));
- cl_assert(git_path_isdir("t3/c"));
- cl_assert(git_path_isdir("t3/c/d"));
- cl_assert(git_path_isdir("t3/c/e"));
+ cl_assert(git_fs_path_isdir("t3"));
+ cl_assert(git_fs_path_isdir("t3/b"));
+ cl_assert(git_fs_path_isdir("t3/c"));
+ cl_assert(git_fs_path_isdir("t3/c/d"));
+ cl_assert(git_fs_path_isdir("t3/c/e"));
assert_hard_link("t3/f1");
assert_hard_link("t3/b/f2");
diff --git a/tests/core/dirent.c b/tests/core/dirent.c
index ce93e0358..2419ec7ab 100644
--- a/tests/core/dirent.c
+++ b/tests/core/dirent.c
@@ -113,7 +113,7 @@ void test_core_dirent__dont_traverse_dot(void)
cl_set_cleanup(&dirent_cleanup__cb, &dot);
setup(&dot);
- cl_git_pass(git_path_direach(&dot.path, 0, one_entry, &dot));
+ cl_git_pass(git_fs_path_direach(&dot.path, 0, one_entry, &dot));
check_counts(&dot);
}
@@ -137,7 +137,7 @@ void test_core_dirent__traverse_subfolder(void)
cl_set_cleanup(&dirent_cleanup__cb, &sub);
setup(&sub);
- cl_git_pass(git_path_direach(&sub.path, 0, one_entry, &sub));
+ cl_git_pass(git_fs_path_direach(&sub.path, 0, one_entry, &sub));
check_counts(&sub);
}
@@ -155,7 +155,7 @@ void test_core_dirent__traverse_slash_terminated_folder(void)
cl_set_cleanup(&dirent_cleanup__cb, &sub_slash);
setup(&sub_slash);
- cl_git_pass(git_path_direach(&sub_slash.path, 0, one_entry, &sub_slash));
+ cl_git_pass(git_fs_path_direach(&sub_slash.path, 0, one_entry, &sub_slash));
check_counts(&sub_slash);
}
@@ -176,12 +176,12 @@ void test_core_dirent__dont_traverse_empty_folders(void)
cl_set_cleanup(&dirent_cleanup__cb, &empty);
setup(&empty);
- cl_git_pass(git_path_direach(&empty.path, 0, one_entry, &empty));
+ cl_git_pass(git_fs_path_direach(&empty.path, 0, one_entry, &empty));
check_counts(&empty);
/* make sure callback not called */
- cl_assert(git_path_is_empty_dir(empty.path.ptr));
+ cl_assert(git_fs_path_is_empty_dir(empty.path.ptr));
}
static name_data odd_names[] = {
@@ -204,7 +204,7 @@ void test_core_dirent__traverse_weird_filenames(void)
cl_set_cleanup(&dirent_cleanup__cb, &odd);
setup(&odd);
- cl_git_pass(git_path_direach(&odd.path, 0, one_entry, &odd));
+ cl_git_pass(git_fs_path_direach(&odd.path, 0, one_entry, &odd));
check_counts(&odd);
}
@@ -224,30 +224,30 @@ void test_core_dirent__length_limits(void)
void test_core_dirent__empty_dir(void)
{
cl_must_pass(p_mkdir("empty_dir", 0777));
- cl_assert(git_path_is_empty_dir("empty_dir"));
+ cl_assert(git_fs_path_is_empty_dir("empty_dir"));
cl_git_mkfile("empty_dir/content", "whatever\n");
- cl_assert(!git_path_is_empty_dir("empty_dir"));
- cl_assert(!git_path_is_empty_dir("empty_dir/content"));
+ cl_assert(!git_fs_path_is_empty_dir("empty_dir"));
+ cl_assert(!git_fs_path_is_empty_dir("empty_dir/content"));
cl_must_pass(p_unlink("empty_dir/content"));
cl_must_pass(p_mkdir("empty_dir/content", 0777));
- cl_assert(!git_path_is_empty_dir("empty_dir"));
- cl_assert(git_path_is_empty_dir("empty_dir/content"));
+ cl_assert(!git_fs_path_is_empty_dir("empty_dir"));
+ cl_assert(git_fs_path_is_empty_dir("empty_dir/content"));
cl_must_pass(p_rmdir("empty_dir/content"));
cl_must_pass(p_rmdir("empty_dir"));
}
-static void handle_next(git_path_diriter *diriter, walk_data *walk)
+static void handle_next(git_fs_path_diriter *diriter, walk_data *walk)
{
const char *fullpath, *filename;
size_t fullpath_len, filename_len;
- cl_git_pass(git_path_diriter_fullpath(&fullpath, &fullpath_len, diriter));
- cl_git_pass(git_path_diriter_filename(&filename, &filename_len, diriter));
+ cl_git_pass(git_fs_path_diriter_fullpath(&fullpath, &fullpath_len, diriter));
+ cl_git_pass(git_fs_path_diriter_filename(&filename, &filename_len, diriter));
cl_assert_equal_strn(fullpath, "sub/", 4);
cl_assert_equal_s(fullpath+4, filename);
@@ -258,42 +258,42 @@ static void handle_next(git_path_diriter *diriter, walk_data *walk)
/* test directory iterator */
void test_core_dirent__diriter_with_fullname(void)
{
- git_path_diriter diriter = GIT_PATH_DIRITER_INIT;
+ git_fs_path_diriter diriter = GIT_FS_PATH_DIRITER_INIT;
int error;
cl_set_cleanup(&dirent_cleanup__cb, &sub);
setup(&sub);
- cl_git_pass(git_path_diriter_init(&diriter, sub.path.ptr, 0));
+ cl_git_pass(git_fs_path_diriter_init(&diriter, sub.path.ptr, 0));
- while ((error = git_path_diriter_next(&diriter)) == 0)
+ while ((error = git_fs_path_diriter_next(&diriter)) == 0)
handle_next(&diriter, &sub);
cl_assert_equal_i(error, GIT_ITEROVER);
- git_path_diriter_free(&diriter);
+ git_fs_path_diriter_free(&diriter);
check_counts(&sub);
}
void test_core_dirent__diriter_at_directory_root(void)
{
- git_path_diriter diriter = GIT_PATH_DIRITER_INIT;
+ git_fs_path_diriter diriter = GIT_FS_PATH_DIRITER_INIT;
const char *sandbox_path, *path;
char *root_path;
size_t path_len;
int root_offset, error;
sandbox_path = clar_sandbox_path();
- cl_assert((root_offset = git_path_root(sandbox_path)) >= 0);
+ cl_assert((root_offset = git_fs_path_root(sandbox_path)) >= 0);
cl_assert(root_path = git__calloc(1, root_offset + 2));
strncpy(root_path, sandbox_path, root_offset + 1);
- cl_git_pass(git_path_diriter_init(&diriter, root_path, 0));
+ cl_git_pass(git_fs_path_diriter_init(&diriter, root_path, 0));
- while ((error = git_path_diriter_next(&diriter)) == 0) {
- cl_git_pass(git_path_diriter_fullpath(&path, &path_len, &diriter));
+ while ((error = git_fs_path_diriter_next(&diriter)) == 0) {
+ cl_git_pass(git_fs_path_diriter_fullpath(&path, &path_len, &diriter));
cl_assert(path_len > (size_t)(root_offset + 1));
cl_assert(path[root_offset+1] != '/');
@@ -301,6 +301,6 @@ void test_core_dirent__diriter_at_directory_root(void)
cl_assert_equal_i(error, GIT_ITEROVER);
- git_path_diriter_free(&diriter);
+ git_fs_path_diriter_free(&diriter);
git__free(root_path);
}
diff --git a/tests/core/env.c b/tests/core/env.c
index 9a3f0ae76..88c5c6aa3 100644
--- a/tests/core/env.c
+++ b/tests/core/env.c
@@ -103,7 +103,7 @@ void test_core_env__0(void)
continue;
}
- cl_git_pass(git_path_prettify(&path, *val, NULL));
+ cl_git_pass(git_fs_path_prettify(&path, *val, NULL));
/* vary testfile name in each directory so accidentally leaving
* an environment variable set from a previous iteration won't
@@ -137,7 +137,7 @@ void test_core_env__0(void)
cl_git_pass(git_sysdir_find_global_file(&found, testfile));
{
- int root = git_path_root(path.ptr);
+ int root = git_fs_path_root(path.ptr);
char old;
if (root >= 0) {
@@ -270,7 +270,7 @@ void test_core_env__2(void)
continue;
}
- cl_git_pass(git_path_prettify(&path, *val, NULL));
+ cl_git_pass(git_fs_path_prettify(&path, *val, NULL));
/* vary testfile name so any sloppiness is resetting variables or
* deleting files won't accidentally make a test pass.
diff --git a/tests/core/filebuf.c b/tests/core/filebuf.c
index 6f654f523..6f40c2456 100644
--- a/tests/core/filebuf.c
+++ b/tests/core/filebuf.c
@@ -14,7 +14,7 @@ void test_core_filebuf__0(void)
cl_must_pass(p_close(fd));
cl_git_fail(git_filebuf_open(&file, test, 0, 0666));
- cl_assert(git_path_exists(testlock));
+ cl_assert(git_fs_path_exists(testlock));
cl_must_pass(p_unlink(testlock));
}
@@ -142,14 +142,14 @@ void test_core_filebuf__rename_error(void)
cl_git_pass(git_filebuf_printf(&file, "%s\n", "libgit2 rocks"));
- cl_assert_equal_i(true, git_path_exists(test_lock));
+ cl_assert_equal_i(true, git_fs_path_exists(test_lock));
cl_git_fail(git_filebuf_commit(&file));
p_close(fd);
git_filebuf_cleanup(&file);
- cl_assert_equal_i(false, git_path_exists(test_lock));
+ cl_assert_equal_i(false, git_fs_path_exists(test_lock));
}
void test_core_filebuf__symlink_follow(void)
@@ -157,7 +157,7 @@ void test_core_filebuf__symlink_follow(void)
git_filebuf file = GIT_FILEBUF_INIT;
const char *dir = "linkdir", *source = "linkdir/link";
- if (!git_path_supports_symlinks(clar_sandbox_path()))
+ if (!git_fs_path_supports_symlinks(clar_sandbox_path()))
cl_skip();
cl_git_pass(p_mkdir(dir, 0777));
@@ -166,10 +166,10 @@ void test_core_filebuf__symlink_follow(void)
cl_git_pass(git_filebuf_open(&file, source, 0, 0666));
cl_git_pass(git_filebuf_printf(&file, "%s\n", "libgit2 rocks"));
- cl_assert_equal_i(true, git_path_exists("linkdir/target.lock"));
+ cl_assert_equal_i(true, git_fs_path_exists("linkdir/target.lock"));
cl_git_pass(git_filebuf_commit(&file));
- cl_assert_equal_i(true, git_path_exists("linkdir/target"));
+ cl_assert_equal_i(true, git_fs_path_exists("linkdir/target"));
git_filebuf_cleanup(&file);
@@ -177,10 +177,10 @@ void test_core_filebuf__symlink_follow(void)
cl_git_pass(git_filebuf_open(&file, source, 0, 0666));
cl_git_pass(git_filebuf_printf(&file, "%s\n", "libgit2 rocks"));
- cl_assert_equal_i(true, git_path_exists("linkdir/target.lock"));
+ cl_assert_equal_i(true, git_fs_path_exists("linkdir/target.lock"));
cl_git_pass(git_filebuf_commit(&file));
- cl_assert_equal_i(true, git_path_exists("linkdir/target"));
+ cl_assert_equal_i(true, git_fs_path_exists("linkdir/target"));
git_filebuf_cleanup(&file);
cl_git_pass(git_futils_rmdir_r(dir, NULL, GIT_RMDIR_REMOVE_FILES));
@@ -191,7 +191,7 @@ void test_core_filebuf__symlink_follow_absolute_paths(void)
git_filebuf file = GIT_FILEBUF_INIT;
git_str source = GIT_STR_INIT, target = GIT_STR_INIT;
- if (!git_path_supports_symlinks(clar_sandbox_path()))
+ if (!git_fs_path_supports_symlinks(clar_sandbox_path()))
cl_skip();
cl_git_pass(git_str_joinpath(&source, clar_sandbox_path(), "linkdir/link"));
@@ -202,10 +202,10 @@ void test_core_filebuf__symlink_follow_absolute_paths(void)
cl_git_pass(git_filebuf_open(&file, source.ptr, 0, 0666));
cl_git_pass(git_filebuf_printf(&file, "%s\n", "libgit2 rocks"));
- cl_assert_equal_i(true, git_path_exists("linkdir/target.lock"));
+ cl_assert_equal_i(true, git_fs_path_exists("linkdir/target.lock"));
cl_git_pass(git_filebuf_commit(&file));
- cl_assert_equal_i(true, git_path_exists("linkdir/target"));
+ cl_assert_equal_i(true, git_fs_path_exists("linkdir/target"));
git_filebuf_cleanup(&file);
git_str_dispose(&source);
@@ -219,7 +219,7 @@ void test_core_filebuf__symlink_depth(void)
git_filebuf file = GIT_FILEBUF_INIT;
const char *dir = "linkdir", *source = "linkdir/link";
- if (!git_path_supports_symlinks(clar_sandbox_path()))
+ if (!git_fs_path_supports_symlinks(clar_sandbox_path()))
cl_skip();
cl_git_pass(p_mkdir(dir, 0777));
diff --git a/tests/core/futils.c b/tests/core/futils.c
index d08043b6e..b87ea183b 100644
--- a/tests/core/futils.c
+++ b/tests/core/futils.c
@@ -68,7 +68,7 @@ void test_core_futils__write_hidden_file(void)
void test_core_futils__recursive_rmdir_keeps_symlink_targets(void)
{
- if (!git_path_supports_symlinks(clar_sandbox_path()))
+ if (!git_fs_path_supports_symlinks(clar_sandbox_path()))
cl_skip();
cl_git_pass(git_futils_mkdir_r("a/b", 0777));
@@ -80,8 +80,8 @@ void test_core_futils__recursive_rmdir_keeps_symlink_targets(void)
cl_git_pass(git_futils_rmdir_r("a", NULL, GIT_RMDIR_REMOVE_FILES));
- cl_assert(git_path_exists("dir-target"));
- cl_assert(git_path_exists("file-target"));
+ cl_assert(git_fs_path_exists("dir-target"));
+ cl_assert(git_fs_path_exists("file-target"));
cl_must_pass(p_unlink("dir-target/file"));
cl_must_pass(p_rmdir("dir-target"));
diff --git a/tests/core/iconv.c b/tests/core/iconv.c
index 498094bdb..af1b4eabf 100644
--- a/tests/core/iconv.c
+++ b/tests/core/iconv.c
@@ -1,8 +1,8 @@
#include "clar_libgit2.h"
-#include "path.h"
+#include "fs_path.h"
#ifdef GIT_USE_ICONV
-static git_path_iconv_t ic;
+static git_fs_path_iconv_t ic;
static char *nfc = "\xC3\x85\x73\x74\x72\xC3\xB6\x6D";
static char *nfd = "\x41\xCC\x8A\x73\x74\x72\x6F\xCC\x88\x6D";
#endif
@@ -10,14 +10,14 @@ static char *nfd = "\x41\xCC\x8A\x73\x74\x72\x6F\xCC\x88\x6D";
void test_core_iconv__initialize(void)
{
#ifdef GIT_USE_ICONV
- cl_git_pass(git_path_iconv_init_precompose(&ic));
+ cl_git_pass(git_fs_path_iconv_init_precompose(&ic));
#endif
}
void test_core_iconv__cleanup(void)
{
#ifdef GIT_USE_ICONV
- git_path_iconv_clear(&ic);
+ git_fs_path_iconv_clear(&ic);
#endif
}
@@ -27,7 +27,7 @@ void test_core_iconv__unchanged(void)
const char *data = "Ascii data", *original = data;
size_t datalen = strlen(data);
- cl_git_pass(git_path_iconv(&ic, &data, &datalen));
+ cl_git_pass(git_fs_path_iconv(&ic, &data, &datalen));
GIT_UNUSED(datalen);
/* There are no high bits set, so this should leave data untouched */
@@ -42,7 +42,7 @@ void test_core_iconv__decomposed_to_precomposed(void)
size_t datalen, nfdlen = strlen(nfd);
datalen = nfdlen;
- cl_git_pass(git_path_iconv(&ic, &data, &datalen));
+ cl_git_pass(git_fs_path_iconv(&ic, &data, &datalen));
GIT_UNUSED(datalen);
/* The decomposed nfd string should be transformed to the nfc form
@@ -50,13 +50,13 @@ void test_core_iconv__decomposed_to_precomposed(void)
*/
cl_assert_equal_s(nfc, data);
- /* should be able to do it multiple times with the same git_path_iconv_t */
+ /* should be able to do it multiple times with the same git_fs_path_iconv_t */
data = nfd; datalen = nfdlen;
- cl_git_pass(git_path_iconv(&ic, &data, &datalen));
+ cl_git_pass(git_fs_path_iconv(&ic, &data, &datalen));
cl_assert_equal_s(nfc, data);
data = nfd; datalen = nfdlen;
- cl_git_pass(git_path_iconv(&ic, &data, &datalen));
+ cl_git_pass(git_fs_path_iconv(&ic, &data, &datalen));
cl_assert_equal_s(nfc, data);
#endif
}
@@ -67,7 +67,7 @@ void test_core_iconv__precomposed_is_unmodified(void)
const char *data = nfc;
size_t datalen = strlen(nfc);
- cl_git_pass(git_path_iconv(&ic, &data, &datalen));
+ cl_git_pass(git_fs_path_iconv(&ic, &data, &datalen));
GIT_UNUSED(datalen);
/* data is already in precomposed form, so even though some bytes have
diff --git a/tests/core/mkdir.c b/tests/core/mkdir.c
index f0461ac1f..8d4b9afd6 100644
--- a/tests/core/mkdir.c
+++ b/tests/core/mkdir.c
@@ -22,32 +22,32 @@ void test_core_mkdir__absolute(void)
git_str_joinpath(&path, clar_sandbox_path(), "d0");
/* make a directory */
- cl_assert(!git_path_isdir(path.ptr));
+ cl_assert(!git_fs_path_isdir(path.ptr));
cl_git_pass(git_futils_mkdir(path.ptr, 0755, 0));
- cl_assert(git_path_isdir(path.ptr));
+ cl_assert(git_fs_path_isdir(path.ptr));
git_str_joinpath(&path, path.ptr, "subdir");
- cl_assert(!git_path_isdir(path.ptr));
+ cl_assert(!git_fs_path_isdir(path.ptr));
cl_git_pass(git_futils_mkdir(path.ptr, 0755, 0));
- cl_assert(git_path_isdir(path.ptr));
+ cl_assert(git_fs_path_isdir(path.ptr));
/* ensure mkdir_r works for a single subdir */
git_str_joinpath(&path, path.ptr, "another");
- cl_assert(!git_path_isdir(path.ptr));
+ cl_assert(!git_fs_path_isdir(path.ptr));
cl_git_pass(git_futils_mkdir_r(path.ptr, 0755));
- cl_assert(git_path_isdir(path.ptr));
+ cl_assert(git_fs_path_isdir(path.ptr));
/* ensure mkdir_r works */
git_str_joinpath(&path, clar_sandbox_path(), "d1/foo/bar/asdf");
- cl_assert(!git_path_isdir(path.ptr));
+ cl_assert(!git_fs_path_isdir(path.ptr));
cl_git_pass(git_futils_mkdir_r(path.ptr, 0755));
- cl_assert(git_path_isdir(path.ptr));
+ cl_assert(git_fs_path_isdir(path.ptr));
/* ensure we don't imply recursive */
git_str_joinpath(&path, clar_sandbox_path(), "d2/foo/bar/asdf");
- cl_assert(!git_path_isdir(path.ptr));
+ cl_assert(!git_fs_path_isdir(path.ptr));
cl_git_fail(git_futils_mkdir(path.ptr, 0755, 0));
- cl_assert(!git_path_isdir(path.ptr));
+ cl_assert(!git_fs_path_isdir(path.ptr));
git_str_dispose(&path);
}
@@ -57,39 +57,39 @@ void test_core_mkdir__basic(void)
cl_set_cleanup(cleanup_basic_dirs, NULL);
/* make a directory */
- cl_assert(!git_path_isdir("d0"));
+ cl_assert(!git_fs_path_isdir("d0"));
cl_git_pass(git_futils_mkdir("d0", 0755, 0));
- cl_assert(git_path_isdir("d0"));
+ cl_assert(git_fs_path_isdir("d0"));
/* make a path */
- cl_assert(!git_path_isdir("d1"));
+ cl_assert(!git_fs_path_isdir("d1"));
cl_git_pass(git_futils_mkdir("d1/d1.1/d1.2", 0755, GIT_MKDIR_PATH));
- cl_assert(git_path_isdir("d1"));
- cl_assert(git_path_isdir("d1/d1.1"));
- cl_assert(git_path_isdir("d1/d1.1/d1.2"));
+ cl_assert(git_fs_path_isdir("d1"));
+ cl_assert(git_fs_path_isdir("d1/d1.1"));
+ cl_assert(git_fs_path_isdir("d1/d1.1/d1.2"));
/* make a dir exclusively */
- cl_assert(!git_path_isdir("d2"));
+ cl_assert(!git_fs_path_isdir("d2"));
cl_git_pass(git_futils_mkdir("d2", 0755, GIT_MKDIR_EXCL));
- cl_assert(git_path_isdir("d2"));
+ cl_assert(git_fs_path_isdir("d2"));
/* make exclusive failure */
cl_git_fail(git_futils_mkdir("d2", 0755, GIT_MKDIR_EXCL));
/* make a path exclusively */
- cl_assert(!git_path_isdir("d3"));
+ cl_assert(!git_fs_path_isdir("d3"));
cl_git_pass(git_futils_mkdir("d3/d3.1/d3.2", 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL));
- cl_assert(git_path_isdir("d3"));
- cl_assert(git_path_isdir("d3/d3.1/d3.2"));
+ cl_assert(git_fs_path_isdir("d3"));
+ cl_assert(git_fs_path_isdir("d3/d3.1/d3.2"));
/* make exclusive path failure */
cl_git_fail(git_futils_mkdir("d3/d3.1/d3.2", 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL));
/* ??? Should EXCL only apply to the last item in the path? */
/* path with trailing slash? */
- cl_assert(!git_path_isdir("d4"));
+ cl_assert(!git_fs_path_isdir("d4"));
cl_git_pass(git_futils_mkdir("d4/d4.1/", 0755, GIT_MKDIR_PATH));
- cl_assert(git_path_isdir("d4/d4.1"));
+ cl_assert(git_fs_path_isdir("d4/d4.1"));
}
static void cleanup_basedir(void *ref)
@@ -107,10 +107,10 @@ void test_core_mkdir__with_base(void)
cl_git_pass(git_futils_mkdir(BASEDIR, 0755, GIT_MKDIR_PATH));
cl_git_pass(git_futils_mkdir_relative("a", BASEDIR, 0755, 0, NULL));
- cl_assert(git_path_isdir(BASEDIR "/a"));
+ cl_assert(git_fs_path_isdir(BASEDIR "/a"));
cl_git_pass(git_futils_mkdir_relative("b/b1/b2", BASEDIR, 0755, GIT_MKDIR_PATH, NULL));
- cl_assert(git_path_isdir(BASEDIR "/b/b1/b2"));
+ cl_assert(git_fs_path_isdir(BASEDIR "/b/b1/b2"));
/* exclusive with existing base */
cl_git_pass(git_futils_mkdir_relative("c/c1/c2", BASEDIR, 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL, NULL));
@@ -126,7 +126,7 @@ void test_core_mkdir__with_base(void)
/* path with shorter base and existing dirs */
cl_git_pass(git_futils_mkdir_relative("dir/here/d/", "base", 0755, GIT_MKDIR_PATH, NULL));
- cl_assert(git_path_isdir("base/dir/here/d"));
+ cl_assert(git_fs_path_isdir("base/dir/here/d"));
/* fail: path with shorter base and existing dirs */
cl_git_fail(git_futils_mkdir_relative("dir/here/e/", "base", 0755, GIT_MKDIR_PATH | GIT_MKDIR_EXCL, NULL));
@@ -179,51 +179,51 @@ void test_core_mkdir__chmods(void)
cl_git_pass(git_futils_mkdir_relative("mode/is/important", "r", 0777, GIT_MKDIR_PATH, NULL));
- cl_git_pass(git_path_lstat("r/mode", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode", &st));
check_mode(0755, st.st_mode);
- cl_git_pass(git_path_lstat("r/mode/is", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode/is", &st));
check_mode(0755, st.st_mode);
- cl_git_pass(git_path_lstat("r/mode/is/important", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode/is/important", &st));
check_mode(0755, st.st_mode);
cl_git_pass(git_futils_mkdir_relative("mode2/is2/important2", "r", 0777, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD, NULL));
- cl_git_pass(git_path_lstat("r/mode2", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode2", &st));
check_mode(0755, st.st_mode);
- cl_git_pass(git_path_lstat("r/mode2/is2", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode2/is2", &st));
check_mode(0755, st.st_mode);
- cl_git_pass(git_path_lstat("r/mode2/is2/important2", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode2/is2/important2", &st));
check_mode(0777, st.st_mode);
cl_git_pass(git_futils_mkdir_relative("mode3/is3/important3", "r", 0777, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD_PATH, NULL));
- cl_git_pass(git_path_lstat("r/mode3", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode3", &st));
check_mode(0777, st.st_mode);
- cl_git_pass(git_path_lstat("r/mode3/is3", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode3/is3", &st));
check_mode(0777, st.st_mode);
- cl_git_pass(git_path_lstat("r/mode3/is3/important3", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode3/is3/important3", &st));
check_mode(0777, st.st_mode);
/* test that we chmod existing dir */
cl_git_pass(git_futils_mkdir_relative("mode/is/important", "r", 0777, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD, NULL));
- cl_git_pass(git_path_lstat("r/mode", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode", &st));
check_mode(0755, st.st_mode);
- cl_git_pass(git_path_lstat("r/mode/is", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode/is", &st));
check_mode(0755, st.st_mode);
- cl_git_pass(git_path_lstat("r/mode/is/important", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode/is/important", &st));
check_mode(0777, st.st_mode);
/* test that we chmod even existing dirs if CHMOD_PATH is set */
cl_git_pass(git_futils_mkdir_relative("mode2/is2/important2.1", "r", 0777, GIT_MKDIR_PATH | GIT_MKDIR_CHMOD_PATH, NULL));
- cl_git_pass(git_path_lstat("r/mode2", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode2", &st));
check_mode(0777, st.st_mode);
- cl_git_pass(git_path_lstat("r/mode2/is2", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode2/is2", &st));
check_mode(0777, st.st_mode);
- cl_git_pass(git_path_lstat("r/mode2/is2/important2.1", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode2/is2/important2.1", &st));
check_mode(0777, st.st_mode);
}
@@ -235,27 +235,27 @@ void test_core_mkdir__keeps_parent_symlinks(void)
cl_set_cleanup(cleanup_basic_dirs, NULL);
/* make a directory */
- cl_assert(!git_path_isdir("d0"));
+ cl_assert(!git_fs_path_isdir("d0"));
cl_git_pass(git_futils_mkdir("d0", 0755, 0));
- cl_assert(git_path_isdir("d0"));
+ cl_assert(git_fs_path_isdir("d0"));
cl_must_pass(symlink("d0", "d1"));
- cl_assert(git_path_islink("d1"));
+ cl_assert(git_fs_path_islink("d1"));
cl_git_pass(git_futils_mkdir("d1/foo/bar", 0755, GIT_MKDIR_PATH|GIT_MKDIR_REMOVE_SYMLINKS));
- cl_assert(git_path_islink("d1"));
- cl_assert(git_path_isdir("d1/foo/bar"));
- cl_assert(git_path_isdir("d0/foo/bar"));
+ cl_assert(git_fs_path_islink("d1"));
+ cl_assert(git_fs_path_isdir("d1/foo/bar"));
+ cl_assert(git_fs_path_isdir("d0/foo/bar"));
cl_must_pass(symlink("d0", "d2"));
- cl_assert(git_path_islink("d2"));
+ cl_assert(git_fs_path_islink("d2"));
git_str_joinpath(&path, clar_sandbox_path(), "d2/other/dir");
cl_git_pass(git_futils_mkdir(path.ptr, 0755, GIT_MKDIR_PATH|GIT_MKDIR_REMOVE_SYMLINKS));
- cl_assert(git_path_islink("d2"));
- cl_assert(git_path_isdir("d2/other/dir"));
- cl_assert(git_path_isdir("d0/other/dir"));
+ cl_assert(git_fs_path_islink("d2"));
+ cl_assert(git_fs_path_isdir("d2/other/dir"));
+ cl_assert(git_fs_path_isdir("d0/other/dir"));
git_str_dispose(&path);
#endif
@@ -276,16 +276,16 @@ void test_core_mkdir__mkdir_path_inside_unwriteable_parent(void)
cl_git_pass(git_futils_mkdir("r", 0777, 0));
cl_git_pass(git_futils_mkdir_relative("mode/is/important", "r", 0777, GIT_MKDIR_PATH, NULL));
- cl_git_pass(git_path_lstat("r/mode", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode", &st));
check_mode(0755, st.st_mode);
cl_must_pass(p_chmod("r/mode", 0111));
- cl_git_pass(git_path_lstat("r/mode", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode", &st));
check_mode(0111, st.st_mode);
cl_git_pass(
git_futils_mkdir_relative("mode/is/okay/inside", "r", 0777, GIT_MKDIR_PATH, NULL));
- cl_git_pass(git_path_lstat("r/mode/is/okay/inside", &st));
+ cl_git_pass(git_fs_path_lstat("r/mode/is/okay/inside", &st));
check_mode(0755, st.st_mode);
cl_must_pass(p_chmod("r/mode", 0777));
diff --git a/tests/core/path.c b/tests/core/path.c
index 6decf23ea..563dcd2a3 100644
--- a/tests/core/path.c
+++ b/tests/core/path.c
@@ -1,5 +1,6 @@
#include "clar_libgit2.h"
#include "futils.h"
+#include "fs_path.h"
static void
check_dirname(const char *A, const char *B)
@@ -7,11 +8,11 @@ check_dirname(const char *A, const char *B)
git_str dir = GIT_STR_INIT;
char *dir2;
- cl_assert(git_path_dirname_r(&dir, A) >= 0);
+ cl_assert(git_fs_path_dirname_r(&dir, A) >= 0);
cl_assert_equal_s(B, dir.ptr);
git_str_dispose(&dir);
- cl_assert((dir2 = git_path_dirname(A)) != NULL);
+ cl_assert((dir2 = git_fs_path_dirname(A)) != NULL);
cl_assert_equal_s(B, dir2);
git__free(dir2);
}
@@ -22,11 +23,11 @@ check_basename(const char *A, const char *B)
git_str base = GIT_STR_INIT;
char *base2;
- cl_assert(git_path_basename_r(&base, A) >= 0);
+ cl_assert(git_fs_path_basename_r(&base, A) >= 0);
cl_assert_equal_s(B, base.ptr);
git_str_dispose(&base);
- cl_assert((base2 = git_path_basename(A)) != NULL);
+ cl_assert((base2 = git_fs_path_basename(A)) != NULL);
cl_assert_equal_s(B, base2);
git__free(base2);
}
@@ -175,7 +176,7 @@ check_path_to_dir(
git_str tgt = GIT_STR_INIT;
git_str_sets(&tgt, path);
- cl_git_pass(git_path_to_dir(&tgt));
+ cl_git_pass(git_fs_path_to_dir(&tgt));
cl_assert_equal_s(expected, tgt.ptr);
git_str_dispose(&tgt);
@@ -193,7 +194,7 @@ check_string_to_dir(
strncpy(buf, path, len + 2);
- git_path_string_to_dir(buf, maxlen);
+ git_fs_path_string_to_dir(buf, maxlen);
cl_assert_equal_s(expected, buf);
@@ -294,10 +295,10 @@ static void check_fromurl(const char *expected_result, const char *input, int sh
assert(should_fail || expected_result);
if (!should_fail) {
- cl_git_pass(git_path_fromurl(&buf, input));
+ cl_git_pass(git_fs_path_fromurl(&buf, input));
cl_assert_equal_s(expected_result, git_str_cstr(&buf));
} else
- cl_git_fail(git_path_fromurl(&buf, input));
+ cl_git_fail(git_fs_path_fromurl(&buf, input));
git_str_dispose(&buf);
}
@@ -402,7 +403,7 @@ void test_core_path__11_walkup(void)
info.expect_idx = i;
cl_git_pass(
- git_path_walk_up(&p, root[j], check_one_walkup_step, &info)
+ git_fs_path_walk_up(&p, root[j], check_one_walkup_step, &info)
);
cl_assert_equal_s(p.ptr, expect[i]);
@@ -439,7 +440,7 @@ void test_core_path__11a_walkup_cancel(void)
cl_assert_equal_i(
CANCEL_VALUE,
- git_path_walk_up(&p, root[j], check_one_walkup_step, &info)
+ git_fs_path_walk_up(&p, root[j], check_one_walkup_step, &info)
);
/* skip to next run of expectations */
@@ -451,16 +452,16 @@ void test_core_path__11a_walkup_cancel(void)
void test_core_path__12_offset_to_path_root(void)
{
- cl_assert(git_path_root("non/rooted/path") == -1);
- cl_assert(git_path_root("/rooted/path") == 0);
+ cl_assert(git_fs_path_root("non/rooted/path") == -1);
+ cl_assert(git_fs_path_root("/rooted/path") == 0);
#ifdef GIT_WIN32
/* Windows specific tests */
- cl_assert(git_path_root("C:non/rooted/path") == -1);
- cl_assert(git_path_root("C:/rooted/path") == 2);
- cl_assert(git_path_root("//computername/sharefolder/resource") == 14);
- cl_assert(git_path_root("//computername/sharefolder") == 14);
- cl_assert(git_path_root("//computername") == -1);
+ cl_assert(git_fs_path_root("C:non/rooted/path") == -1);
+ cl_assert(git_fs_path_root("C:/rooted/path") == 2);
+ cl_assert(git_fs_path_root("//computername/sharefolder/resource") == 14);
+ cl_assert(git_fs_path_root("//computername/sharefolder") == 14);
+ cl_assert(git_fs_path_root("//computername") == -1);
#endif
}
@@ -470,9 +471,9 @@ void test_core_path__13_cannot_prettify_a_non_existing_file(void)
{
git_str p = GIT_STR_INIT;
- cl_assert_equal_b(git_path_exists(NON_EXISTING_FILEPATH), false);
- cl_assert_equal_i(GIT_ENOTFOUND, git_path_prettify(&p, NON_EXISTING_FILEPATH, NULL));
- cl_assert_equal_i(GIT_ENOTFOUND, git_path_prettify(&p, NON_EXISTING_FILEPATH "/so-do-i", NULL));
+ cl_assert_equal_b(git_fs_path_exists(NON_EXISTING_FILEPATH), false);
+ cl_assert_equal_i(GIT_ENOTFOUND, git_fs_path_prettify(&p, NON_EXISTING_FILEPATH, NULL));
+ cl_assert_equal_i(GIT_ENOTFOUND, git_fs_path_prettify(&p, NON_EXISTING_FILEPATH "/so-do-i", NULL));
git_str_dispose(&p);
}
@@ -483,57 +484,57 @@ void test_core_path__14_apply_relative(void)
cl_git_pass(git_str_sets(&p, "/this/is/a/base"));
- cl_git_pass(git_path_apply_relative(&p, "../test"));
+ cl_git_pass(git_fs_path_apply_relative(&p, "../test"));
cl_assert_equal_s("/this/is/a/test", p.ptr);
- cl_git_pass(git_path_apply_relative(&p, "../../the/./end"));
+ cl_git_pass(git_fs_path_apply_relative(&p, "../../the/./end"));
cl_assert_equal_s("/this/is/the/end", p.ptr);
- cl_git_pass(git_path_apply_relative(&p, "./of/this/../the/string"));
+ cl_git_pass(git_fs_path_apply_relative(&p, "./of/this/../the/string"));
cl_assert_equal_s("/this/is/the/end/of/the/string", p.ptr);
- cl_git_pass(git_path_apply_relative(&p, "../../../../../.."));
+ cl_git_pass(git_fs_path_apply_relative(&p, "../../../../../.."));
cl_assert_equal_s("/this/", p.ptr);
- cl_git_pass(git_path_apply_relative(&p, "../"));
+ cl_git_pass(git_fs_path_apply_relative(&p, "../"));
cl_assert_equal_s("/", p.ptr);
- cl_git_fail(git_path_apply_relative(&p, "../../.."));
+ cl_git_fail(git_fs_path_apply_relative(&p, "../../.."));
cl_git_pass(git_str_sets(&p, "d:/another/test"));
- cl_git_pass(git_path_apply_relative(&p, "../.."));
+ cl_git_pass(git_fs_path_apply_relative(&p, "../.."));
cl_assert_equal_s("d:/", p.ptr);
- cl_git_pass(git_path_apply_relative(&p, "from/here/to/../and/./back/."));
+ cl_git_pass(git_fs_path_apply_relative(&p, "from/here/to/../and/./back/."));
cl_assert_equal_s("d:/from/here/and/back/", p.ptr);
cl_git_pass(git_str_sets(&p, "https://my.url.com/test.git"));
- cl_git_pass(git_path_apply_relative(&p, "../another.git"));
+ cl_git_pass(git_fs_path_apply_relative(&p, "../another.git"));
cl_assert_equal_s("https://my.url.com/another.git", p.ptr);
- cl_git_pass(git_path_apply_relative(&p, "../full/path/url.patch"));
+ cl_git_pass(git_fs_path_apply_relative(&p, "../full/path/url.patch"));
cl_assert_equal_s("https://my.url.com/full/path/url.patch", p.ptr);
- cl_git_pass(git_path_apply_relative(&p, ".."));
+ cl_git_pass(git_fs_path_apply_relative(&p, ".."));
cl_assert_equal_s("https://my.url.com/full/path/", p.ptr);
- cl_git_pass(git_path_apply_relative(&p, "../../../"));
+ cl_git_pass(git_fs_path_apply_relative(&p, "../../../"));
cl_assert_equal_s("https://", p.ptr);
cl_git_pass(git_str_sets(&p, "../../this/is/relative"));
- cl_git_pass(git_path_apply_relative(&p, "../../preserves/the/prefix"));
+ cl_git_pass(git_fs_path_apply_relative(&p, "../../preserves/the/prefix"));
cl_assert_equal_s("../../this/preserves/the/prefix", p.ptr);
- cl_git_pass(git_path_apply_relative(&p, "../../../../that"));
+ cl_git_pass(git_fs_path_apply_relative(&p, "../../../../that"));
cl_assert_equal_s("../../that", p.ptr);
- cl_git_pass(git_path_apply_relative(&p, "../there"));
+ cl_git_pass(git_fs_path_apply_relative(&p, "../there"));
cl_assert_equal_s("../../there", p.ptr);
git_str_dispose(&p);
}
@@ -542,7 +543,7 @@ static void assert_resolve_relative(
git_str *buf, const char *expected, const char *path)
{
cl_git_pass(git_str_sets(buf, path));
- cl_git_pass(git_path_resolve_relative(buf, 0));
+ cl_git_pass(git_fs_path_resolve_relative(buf, 0));
cl_assert_equal_s(expected, buf->ptr);
}
@@ -596,22 +597,22 @@ void test_core_path__15_resolve_relative(void)
assert_resolve_relative(&buf, "../d", "a/b/../../../c/../d");
cl_git_pass(git_str_sets(&buf, "/.."));
- cl_git_fail(git_path_resolve_relative(&buf, 0));
+ cl_git_fail(git_fs_path_resolve_relative(&buf, 0));
cl_git_pass(git_str_sets(&buf, "/./.."));
- cl_git_fail(git_path_resolve_relative(&buf, 0));
+ cl_git_fail(git_fs_path_resolve_relative(&buf, 0));
cl_git_pass(git_str_sets(&buf, "/.//.."));
- cl_git_fail(git_path_resolve_relative(&buf, 0));
+ cl_git_fail(git_fs_path_resolve_relative(&buf, 0));
cl_git_pass(git_str_sets(&buf, "/../."));
- cl_git_fail(git_path_resolve_relative(&buf, 0));
+ cl_git_fail(git_fs_path_resolve_relative(&buf, 0));
cl_git_pass(git_str_sets(&buf, "/../.././../a"));
- cl_git_fail(git_path_resolve_relative(&buf, 0));
+ cl_git_fail(git_fs_path_resolve_relative(&buf, 0));
cl_git_pass(git_str_sets(&buf, "////.."));
- cl_git_fail(git_path_resolve_relative(&buf, 0));
+ cl_git_fail(git_fs_path_resolve_relative(&buf, 0));
/* things that start with Windows network paths */
#ifdef GIT_WIN32
@@ -620,7 +621,7 @@ void test_core_path__15_resolve_relative(void)
assert_resolve_relative(&buf, "//a/b/c", "//a/Q/../b/x/y/../../c");
cl_git_pass(git_str_sets(&buf, "//a/b/../.."));
- cl_git_fail(git_path_resolve_relative(&buf, 0));
+ cl_git_fail(git_fs_path_resolve_relative(&buf, 0));
#else
assert_resolve_relative(&buf, "/a/b/c", "//a/b/c");
assert_resolve_relative(&buf, "/a/", "//a/b/..");
@@ -632,7 +633,7 @@ void test_core_path__15_resolve_relative(void)
}
#define assert_common_dirlen(i, p, q) \
- cl_assert_equal_i((i), git_path_common_dirlen((p), (q)));
+ cl_assert_equal_i((i), git_fs_path_common_dirlen((p), (q)));
void test_core_path__16_resolve_relative(void)
{
@@ -650,12 +651,3 @@ void test_core_path__16_resolve_relative(void)
assert_common_dirlen(6, "a/b/c/foo.txt", "a/b/c/d/e/bar.txt");
assert_common_dirlen(7, "/a/b/c/foo.txt", "/a/b/c/d/e/bar.txt");
}
-
-void test_core_path__git_path_is_file(void)
-{
- cl_git_fail(git_path_is_gitfile("blob", 4, -1, GIT_PATH_FS_HFS));
- cl_git_pass(git_path_is_gitfile("blob", 4, GIT_PATH_GITFILE_GITIGNORE, GIT_PATH_FS_HFS));
- cl_git_pass(git_path_is_gitfile("blob", 4, GIT_PATH_GITFILE_GITMODULES, GIT_PATH_FS_HFS));
- cl_git_pass(git_path_is_gitfile("blob", 4, GIT_PATH_GITFILE_GITATTRIBUTES, GIT_PATH_FS_HFS));
- cl_git_fail(git_path_is_gitfile("blob", 4, 3, GIT_PATH_FS_HFS));
-}
diff --git a/tests/core/posix.c b/tests/core/posix.c
index 247bd43f5..cba312913 100644
--- a/tests/core/posix.c
+++ b/tests/core/posix.c
@@ -147,7 +147,7 @@ void test_core_posix__utimes(void)
void test_core_posix__unlink_removes_symlink(void)
{
- if (!git_path_supports_symlinks(clar_sandbox_path()))
+ if (!git_fs_path_supports_symlinks(clar_sandbox_path()))
clar__skip();
cl_git_mkfile("file", "Dummy file.");
@@ -159,8 +159,8 @@ void test_core_posix__unlink_removes_symlink(void)
cl_must_pass(p_unlink("file-symlink"));
cl_must_pass(p_unlink("dir-symlink"));
- cl_assert(git_path_exists("file"));
- cl_assert(git_path_exists("dir"));
+ cl_assert(git_fs_path_exists("file"));
+ cl_assert(git_fs_path_exists("dir"));
cl_must_pass(p_unlink("file"));
cl_must_pass(p_rmdir("dir"));
@@ -170,7 +170,7 @@ void test_core_posix__symlink_resolves_to_correct_type(void)
{
git_str contents = GIT_STR_INIT;
- if (!git_path_supports_symlinks(clar_sandbox_path()))
+ if (!git_fs_path_supports_symlinks(clar_sandbox_path()))
clar__skip();
cl_must_pass(git_futils_mkdir("dir", 0777, 0));
@@ -194,7 +194,7 @@ void test_core_posix__relative_symlink(void)
{
git_str contents = GIT_STR_INIT;
- if (!git_path_supports_symlinks(clar_sandbox_path()))
+ if (!git_fs_path_supports_symlinks(clar_sandbox_path()))
clar__skip();
cl_must_pass(git_futils_mkdir("dir", 0777, 0));
@@ -214,7 +214,7 @@ void test_core_posix__symlink_to_file_across_dirs(void)
{
git_str contents = GIT_STR_INIT;
- if (!git_path_supports_symlinks(clar_sandbox_path()))
+ if (!git_fs_path_supports_symlinks(clar_sandbox_path()))
clar__skip();
/*
diff --git a/tests/core/rmdir.c b/tests/core/rmdir.c
index 56ea320be..8e5bd5878 100644
--- a/tests/core/rmdir.c
+++ b/tests/core/rmdir.c
@@ -29,7 +29,7 @@ void test_core_rmdir__initialize(void)
void test_core_rmdir__cleanup(void)
{
- if (git_path_exists(empty_tmp_dir))
+ if (git_fs_path_exists(empty_tmp_dir))
cl_git_pass(git_futils_rmdir_r(empty_tmp_dir, NULL, GIT_RMDIR_REMOVE_FILES));
}
@@ -38,11 +38,11 @@ void test_core_rmdir__delete_recursive(void)
{
git_str path = GIT_STR_INIT;
cl_git_pass(git_str_joinpath(&path, empty_tmp_dir, "/one"));
- cl_assert(git_path_exists(git_str_cstr(&path)));
+ cl_assert(git_fs_path_exists(git_str_cstr(&path)));
cl_git_pass(git_futils_rmdir_r(empty_tmp_dir, NULL, GIT_RMDIR_EMPTY_HIERARCHY));
- cl_assert(!git_path_exists(git_str_cstr(&path)));
+ cl_assert(!git_fs_path_exists(git_str_cstr(&path)));
git_str_dispose(&path);
}
@@ -61,7 +61,7 @@ void test_core_rmdir__fail_to_delete_non_empty_dir(void)
cl_must_pass(p_unlink(file.ptr));
cl_git_pass(git_futils_rmdir_r(empty_tmp_dir, NULL, GIT_RMDIR_EMPTY_HIERARCHY));
- cl_assert(!git_path_exists(empty_tmp_dir));
+ cl_assert(!git_fs_path_exists(empty_tmp_dir));
git_str_dispose(&file);
}
@@ -69,7 +69,7 @@ void test_core_rmdir__fail_to_delete_non_empty_dir(void)
void test_core_rmdir__keep_base(void)
{
cl_git_pass(git_futils_rmdir_r(empty_tmp_dir, NULL, GIT_RMDIR_SKIP_ROOT));
- cl_assert(git_path_exists(empty_tmp_dir));
+ cl_assert(git_fs_path_exists(empty_tmp_dir));
}
void test_core_rmdir__can_skip_non_empty_dir(void)
@@ -81,10 +81,10 @@ void test_core_rmdir__can_skip_non_empty_dir(void)
cl_git_mkfile(git_str_cstr(&file), "dummy");
cl_git_pass(git_futils_rmdir_r(empty_tmp_dir, NULL, GIT_RMDIR_SKIP_NONEMPTY));
- cl_assert(git_path_exists(git_str_cstr(&file)) == true);
+ cl_assert(git_fs_path_exists(git_str_cstr(&file)) == true);
cl_git_pass(git_futils_rmdir_r(empty_tmp_dir, NULL, GIT_RMDIR_REMOVE_FILES));
- cl_assert(git_path_exists(empty_tmp_dir) == false);
+ cl_assert(git_fs_path_exists(empty_tmp_dir) == false);
git_str_dispose(&file);
}
@@ -96,23 +96,23 @@ void test_core_rmdir__can_remove_empty_parents(void)
cl_git_pass(
git_str_joinpath(&file, empty_tmp_dir, "/one/two_two/three/file.txt"));
cl_git_mkfile(git_str_cstr(&file), "dummy");
- cl_assert(git_path_isfile(git_str_cstr(&file)));
+ cl_assert(git_fs_path_isfile(git_str_cstr(&file)));
cl_git_pass(git_futils_rmdir_r("one/two_two/three/file.txt", empty_tmp_dir,
GIT_RMDIR_REMOVE_FILES | GIT_RMDIR_EMPTY_PARENTS));
- cl_assert(!git_path_exists(git_str_cstr(&file)));
+ cl_assert(!git_fs_path_exists(git_str_cstr(&file)));
git_str_rtruncate_at_char(&file, '/'); /* three (only contained file.txt) */
- cl_assert(!git_path_exists(git_str_cstr(&file)));
+ cl_assert(!git_fs_path_exists(git_str_cstr(&file)));
git_str_rtruncate_at_char(&file, '/'); /* two_two (only contained three) */
- cl_assert(!git_path_exists(git_str_cstr(&file)));
+ cl_assert(!git_fs_path_exists(git_str_cstr(&file)));
git_str_rtruncate_at_char(&file, '/'); /* one (contained two_one also) */
- cl_assert(git_path_exists(git_str_cstr(&file)));
+ cl_assert(git_fs_path_exists(git_str_cstr(&file)));
- cl_assert(git_path_exists(empty_tmp_dir) == true);
+ cl_assert(git_fs_path_exists(empty_tmp_dir) == true);
git_str_dispose(&file);
diff --git a/tests/core/stat.c b/tests/core/stat.c
index 56d141e98..022380ba6 100644
--- a/tests/core/stat.c
+++ b/tests/core/stat.c
@@ -102,7 +102,7 @@ void test_core_stat__root(void)
int root_len;
struct stat st;
- root_len = git_path_root(sandbox);
+ root_len = git_fs_path_root(sandbox);
cl_assert(root_len >= 0);
git_str_set(&root, sandbox, root_len+1);
diff --git a/tests/diff/drivers.c b/tests/diff/drivers.c
index ce24e9bc0..304a54b56 100644
--- a/tests/diff/drivers.c
+++ b/tests/diff/drivers.c
@@ -187,7 +187,7 @@ void test_diff_drivers__builtins(void)
g_repo = cl_git_sandbox_init("userdiff");
- cl_git_pass(git_path_dirload(&files, "userdiff/files", 9, 0));
+ cl_git_pass(git_fs_path_dirload(&files, "userdiff/files", 9, 0));
opts.interhunk_lines = 1;
opts.context_lines = 1;
diff --git a/tests/diff/workdir.c b/tests/diff/workdir.c
index f7c74a294..444fc2f97 100644
--- a/tests/diff/workdir.c
+++ b/tests/diff/workdir.c
@@ -1252,7 +1252,7 @@ void test_diff_workdir__can_diff_empty_file(void)
/* empty contents of file */
cl_git_rewritefile("attr_index/README.txt", "");
- cl_git_pass(git_path_lstat("attr_index/README.txt", &st));
+ cl_git_pass(git_fs_path_lstat("attr_index/README.txt", &st));
cl_assert_equal_i(0, (int)st.st_size);
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, tree, &opts));
@@ -1265,7 +1265,7 @@ void test_diff_workdir__can_diff_empty_file(void)
/* remove a file altogether */
cl_git_pass(p_unlink("attr_index/README.txt"));
- cl_assert(!git_path_exists("attr_index/README.txt"));
+ cl_assert(!git_fs_path_exists("attr_index/README.txt"));
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, tree, &opts));
cl_assert_equal_i(3, (int)git_diff_num_deltas(diff));
@@ -1759,7 +1759,7 @@ static int touch_file(void *payload, git_str *path)
struct p_timeval times[2];
GIT_UNUSED(payload);
- if (git_path_isdir(path->ptr))
+ if (git_fs_path_isdir(path->ptr))
return 0;
cl_must_pass(p_stat(path->ptr, &st));
@@ -1805,7 +1805,7 @@ void test_diff_workdir__can_update_index(void)
{
git_str path = GIT_STR_INIT;
cl_git_pass(git_str_sets(&path, "status"));
- cl_git_pass(git_path_direach(&path, 0, touch_file, NULL));
+ cl_git_pass(git_fs_path_direach(&path, 0, touch_file, NULL));
git_str_dispose(&path);
}
@@ -2040,7 +2040,7 @@ void test_diff_workdir__only_writes_index_when_necessary(void)
/* touch all the files so stat times are different */
cl_git_pass(git_str_sets(&path, "status"));
- cl_git_pass(git_path_direach(&path, 0, touch_file, NULL));
+ cl_git_pass(git_fs_path_direach(&path, 0, touch_file, NULL));
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
git_diff_free(diff);
diff --git a/tests/fetchhead/nonetwork.c b/tests/fetchhead/nonetwork.c
index 0de712be8..334755cc3 100644
--- a/tests/fetchhead/nonetwork.c
+++ b/tests/fetchhead/nonetwork.c
@@ -446,9 +446,9 @@ void test_fetchhead_nonetwork__create_when_refpecs_given(void)
cl_git_pass(git_str_joinpath(&path, git_repository_path(g_repo), "FETCH_HEAD"));
cl_git_pass(git_remote_create(&remote, g_repo, "origin", cl_fixture("testrepo.git")));
- cl_assert(!git_path_exists(path.ptr));
+ cl_assert(!git_fs_path_exists(path.ptr));
cl_git_pass(git_remote_fetch(remote, &specs, NULL, NULL));
- cl_assert(git_path_exists(path.ptr));
+ cl_assert(git_fs_path_exists(path.ptr));
cl_git_pass(git_repository_fetchhead_foreach(g_repo, find_master_haacked, NULL));
cl_assert(find_master_haacked_called);
@@ -500,9 +500,9 @@ void test_fetchhead_nonetwork__create_with_multiple_refspecs(void)
cl_git_pass(git_remote_lookup(&remote, g_repo, "origin"));
cl_git_pass(git_str_joinpath(&path, git_repository_path(g_repo), "FETCH_HEAD"));
- cl_assert(!git_path_exists(path.ptr));
+ cl_assert(!git_fs_path_exists(path.ptr));
cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL));
- cl_assert(git_path_exists(path.ptr));
+ cl_assert(git_fs_path_exists(path.ptr));
{
int i;
diff --git a/tests/ignore/path.c b/tests/ignore/path.c
index d55bdc5dd..a574d1d79 100644
--- a/tests/ignore/path.c
+++ b/tests/ignore/path.c
@@ -257,7 +257,7 @@ void test_ignore_path__skip_gitignore_directory(void)
{
cl_git_rewritefile("attr/.git/info/exclude", "/NewFolder\n/NewFolder/NewFolder");
cl_must_pass(p_unlink("attr/.gitignore"));
- cl_assert(!git_path_exists("attr/.gitignore"));
+ cl_assert(!git_fs_path_exists("attr/.gitignore"));
p_mkdir("attr/.gitignore", 0777);
cl_git_mkfile("attr/.gitignore/garbage.txt", "new_file\n");
@@ -270,7 +270,7 @@ void test_ignore_path__skip_gitignore_directory(void)
void test_ignore_path__subdirectory_gitignore(void)
{
cl_must_pass(p_unlink("attr/.gitignore"));
- cl_assert(!git_path_exists("attr/.gitignore"));
+ cl_assert(!git_fs_path_exists("attr/.gitignore"));
cl_git_mkfile(
"attr/.gitignore",
"file1\n");
diff --git a/tests/index/crlf.c b/tests/index/crlf.c
index 8d2a5fcce..7520c23a3 100644
--- a/tests/index/crlf.c
+++ b/tests/index/crlf.c
@@ -53,7 +53,7 @@ static int add_and_check_file(void *payload, git_str *actual_path)
git_blob *blob;
bool failed = true;
- basename = git_path_basename(actual_path->ptr);
+ basename = git_fs_path_basename(actual_path->ptr);
if (!strcmp(basename, ".git") || !strcmp(basename, ".gitattributes")) {
failed = false;
@@ -65,7 +65,7 @@ static int add_and_check_file(void *payload, git_str *actual_path)
cl_git_pass(git_str_puts(&expected_path_fail, expected_path.ptr));
cl_git_pass(git_str_puts(&expected_path_fail, ".fail"));
- if (git_path_isfile(expected_path.ptr)) {
+ if (git_fs_path_isfile(expected_path.ptr)) {
cl_git_pass(git_index_add_bypath(g_index, basename));
cl_assert(entry = git_index_get_bypath(g_index, basename, 0));
@@ -77,7 +77,7 @@ static int add_and_check_file(void *payload, git_str *actual_path)
goto done;
git_blob_free(blob);
- } else if (git_path_isfile(expected_path_fail.ptr)) {
+ } else if (git_fs_path_isfile(expected_path_fail.ptr)) {
cl_git_pass(git_futils_readbuffer(&expected_contents, expected_path_fail.ptr));
git_str_rtrim(&expected_contents);
@@ -161,7 +161,7 @@ static void test_add_index(const char *safecrlf, const char *autocrlf, const cha
cl_fixture_sandbox(expected_fixture.ptr);
compare_data.dirname = sandboxname.ptr;
- cl_git_pass(git_path_direach(&reponame, 0, add_and_check_file, &compare_data));
+ cl_git_pass(git_fs_path_direach(&reponame, 0, add_and_check_file, &compare_data));
cl_fixture_cleanup(expected_fixture.ptr);
git_str_dispose(&expected_fixture);
@@ -179,9 +179,9 @@ static void set_up_workingdir(const char *name)
size_t i;
const char *fn;
- git_path_dirload(&contents, name, 0, 0);
+ git_fs_path_dirload(&contents, name, 0, 0);
git_vector_foreach(&contents, i, fn) {
- char *basename = git_path_basename(fn);
+ char *basename = git_fs_path_basename(fn);
bool skip = strncasecmp(basename, ".git", 4) == 0 && strlen(basename) == 4;
git__free(basename);
@@ -193,9 +193,9 @@ static void set_up_workingdir(const char *name)
git_vector_free_deep(&contents);
/* copy input files */
- git_path_dirload(&contents, cl_fixture("crlf"), 0, 0);
+ git_fs_path_dirload(&contents, cl_fixture("crlf"), 0, 0);
git_vector_foreach(&contents, i, fn) {
- char *basename = git_path_basename(fn);
+ char *basename = git_fs_path_basename(fn);
git_str dest_filename = GIT_STR_INIT;
if (strcmp(basename, ".gitted") &&
diff --git a/tests/index/tests.c b/tests/index/tests.c
index 9b28028e6..b6715574e 100644
--- a/tests/index/tests.c
+++ b/tests/index/tests.c
@@ -571,9 +571,9 @@ void test_index_tests__cannot_add_invalid_filename(void)
cl_must_pass(p_mkdir("./invalid/subdir", 0777));
/* cl_git_mkfile() needs the dir to exist */
- if (!git_path_exists("./invalid/.GIT"))
+ if (!git_fs_path_exists("./invalid/.GIT"))
cl_must_pass(p_mkdir("./invalid/.GIT", 0777));
- if (!git_path_exists("./invalid/.GiT"))
+ if (!git_fs_path_exists("./invalid/.GiT"))
cl_must_pass(p_mkdir("./invalid/.GiT", 0777));
assert_add_bypath_fails(repo, ".git/hello");
diff --git a/tests/iterator/index.c b/tests/iterator/index.c
index 69b795f5c..7218b4f75 100644
--- a/tests/iterator/index.c
+++ b/tests/iterator/index.c
@@ -283,7 +283,7 @@ void test_iterator_index__case_folding(void)
int fs_is_ci = 0;
cl_git_pass(git_str_joinpath(&path, cl_fixture("icase"), ".gitted/CoNfIg"));
- fs_is_ci = git_path_exists(path.ptr);
+ fs_is_ci = git_fs_path_exists(path.ptr);
git_str_dispose(&path);
index_iterator_test(
diff --git a/tests/iterator/workdir.c b/tests/iterator/workdir.c
index 7ca726c24..86b847cab 100644
--- a/tests/iterator/workdir.c
+++ b/tests/iterator/workdir.c
@@ -1024,7 +1024,7 @@ static void create_paths(const char *root, int depth)
int i;
cl_git_pass(git_str_puts(&fullpath, root));
- cl_git_pass(git_path_to_dir(&fullpath));
+ cl_git_pass(git_fs_path_to_dir(&fullpath));
root_len = fullpath.size;
diff --git a/tests/merge/merge_helpers.c b/tests/merge/merge_helpers.c
index 1eb423ef7..73a1d852d 100644
--- a/tests/merge/merge_helpers.c
+++ b/tests/merge/merge_helpers.c
@@ -346,7 +346,7 @@ int merge_test_workdir(git_repository *repo, const struct merge_index_entry expe
git_str wd = GIT_STR_INIT;
git_str_puts(&wd, repo->workdir);
- git_path_direach(&wd, 0, dircount, &actual_len);
+ git_fs_path_direach(&wd, 0, dircount, &actual_len);
if (actual_len != expected_len)
return 0;
diff --git a/tests/merge/workdir/setup.c b/tests/merge/workdir/setup.c
index fe33e21f2..3db2d074f 100644
--- a/tests/merge/workdir/setup.c
+++ b/tests/merge/workdir/setup.c
@@ -48,15 +48,15 @@ static bool test_file_contents(const char *filename, const char *expected)
{
git_str file_path_buf = GIT_STR_INIT, file_buf = GIT_STR_INIT;
bool equals;
-
+
git_str_joinpath(&file_path_buf, git_repository_path(repo), filename);
-
+
cl_git_pass(git_futils_readbuffer(&file_buf, file_path_buf.ptr));
equals = (strcmp(file_buf.ptr, expected) == 0);
git_str_dispose(&file_path_buf);
git_str_dispose(&file_buf);
-
+
return equals;
}
@@ -77,13 +77,13 @@ void test_merge_workdir_setup__one_branch(void)
git_oid our_oid;
git_reference *octo1_ref;
git_annotated_commit *our_head, *their_heads[1];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
-
+
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
-
+
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 1));
cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n"));
@@ -92,7 +92,7 @@ void test_merge_workdir_setup__one_branch(void)
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branch '" OCTO1_BRANCH "'\n"));
git_reference_free(octo1_ref);
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
}
@@ -103,10 +103,10 @@ void test_merge_workdir_setup__one_oid(void)
git_oid our_oid;
git_oid octo1_oid;
git_annotated_commit *our_head, *their_heads[1];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
-
+
cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_oid));
@@ -128,10 +128,10 @@ void test_merge_workdir_setup__two_branches(void)
git_reference *octo1_ref;
git_reference *octo2_ref;
git_annotated_commit *our_head, *their_heads[2];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
-
+
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
@@ -139,15 +139,15 @@ void test_merge_workdir_setup__two_branches(void)
cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 2));
-
+
cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n"));
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branches '" OCTO1_BRANCH "' and '" OCTO2_BRANCH "'\n"));
-
+
git_reference_free(octo1_ref);
git_reference_free(octo2_ref);
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
git_annotated_commit_free(their_heads[1]);
@@ -161,13 +161,13 @@ void test_merge_workdir_setup__three_branches(void)
git_reference *octo2_ref;
git_reference *octo3_ref;
git_annotated_commit *our_head, *their_heads[3];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
-
+
cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref));
@@ -180,7 +180,7 @@ void test_merge_workdir_setup__three_branches(void)
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branches '" OCTO1_BRANCH "', '" OCTO2_BRANCH "' and '" OCTO3_BRANCH "'\n"));
-
+
git_reference_free(octo1_ref);
git_reference_free(octo2_ref);
git_reference_free(octo3_ref);
@@ -199,13 +199,13 @@ void test_merge_workdir_setup__three_oids(void)
git_oid octo2_oid;
git_oid octo3_oid;
git_annotated_commit *our_head, *their_heads[3];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_oid));
-
+
cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID));
cl_git_pass(git_annotated_commit_lookup(&their_heads[1], repo, &octo2_oid));
@@ -218,7 +218,7 @@ void test_merge_workdir_setup__three_oids(void)
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge commit '" OCTO1_OID "'; commit '" OCTO2_OID "'; commit '" OCTO3_OID "'\n"));
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
git_annotated_commit_free(their_heads[1]);
@@ -232,7 +232,7 @@ void test_merge_workdir_setup__branches_and_oids_1(void)
git_reference *octo1_ref;
git_oid octo2_oid;
git_annotated_commit *our_head, *their_heads[2];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
@@ -248,7 +248,7 @@ void test_merge_workdir_setup__branches_and_oids_1(void)
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branch '" OCTO1_BRANCH "'; commit '" OCTO2_OID "'\n"));
-
+
git_reference_free(octo1_ref);
git_annotated_commit_free(our_head);
@@ -271,23 +271,23 @@ void test_merge_workdir_setup__branches_and_oids_2(void)
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
-
+
cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID));
cl_git_pass(git_annotated_commit_lookup(&their_heads[1], repo, &octo2_oid));
cl_git_pass(git_reference_lookup(&octo3_ref, repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[2], repo, octo3_ref));
-
+
cl_git_pass(git_oid_fromstr(&octo4_oid, OCTO4_OID));
cl_git_pass(git_annotated_commit_lookup(&their_heads[3], repo, &octo4_oid));
-
+
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 4));
cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n" OCTO4_OID "\n"));
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branches '" OCTO1_BRANCH "' and '" OCTO3_BRANCH "'; commit '" OCTO2_OID "'; commit '" OCTO4_OID "'\n"));
-
+
git_reference_free(octo1_ref);
git_reference_free(octo3_ref);
@@ -307,7 +307,7 @@ void test_merge_workdir_setup__branches_and_oids_3(void)
git_oid octo3_oid;
git_reference *octo4_ref;
git_annotated_commit *our_head, *their_heads[4];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
@@ -319,17 +319,17 @@ void test_merge_workdir_setup__branches_and_oids_3(void)
cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID));
cl_git_pass(git_annotated_commit_lookup(&their_heads[2], repo, &octo3_oid));
-
+
cl_git_pass(git_reference_lookup(&octo4_ref, repo, GIT_REFS_HEADS_DIR OCTO4_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[3], repo, octo4_ref));
-
+
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 4));
cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n" OCTO4_OID "\n"));
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge commit '" OCTO1_OID "'; branches '" OCTO2_BRANCH "' and '" OCTO4_BRANCH "'; commit '" OCTO3_OID "'\n"));
-
+
git_reference_free(octo2_ref);
git_reference_free(octo4_ref);
@@ -350,19 +350,19 @@ void test_merge_workdir_setup__branches_and_oids_4(void)
git_reference *octo4_ref;
git_reference *octo5_ref;
git_annotated_commit *our_head, *their_heads[5];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
-
+
cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_oid));
-
+
cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref));
-
+
cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID));
cl_git_pass(git_annotated_commit_lookup(&their_heads[2], repo, &octo3_oid));
-
+
cl_git_pass(git_reference_lookup(&octo4_ref, repo, GIT_REFS_HEADS_DIR OCTO4_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[3], repo, octo4_ref));
@@ -375,7 +375,7 @@ void test_merge_workdir_setup__branches_and_oids_4(void)
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge commit '" OCTO1_OID "'; branches '" OCTO2_BRANCH "', '" OCTO4_BRANCH "' and '" OCTO5_BRANCH "'; commit '" OCTO3_OID "'\n"));
-
+
git_reference_free(octo2_ref);
git_reference_free(octo4_ref);
git_reference_free(octo5_ref);
@@ -396,30 +396,30 @@ void test_merge_workdir_setup__three_same_branches(void)
git_reference *octo1_2_ref;
git_reference *octo1_3_ref;
git_annotated_commit *our_head, *their_heads[3];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
-
+
cl_git_pass(git_reference_lookup(&octo1_1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_1_ref));
-
+
cl_git_pass(git_reference_lookup(&octo1_2_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo1_2_ref));
-
+
cl_git_pass(git_reference_lookup(&octo1_3_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[2], repo, octo1_3_ref));
-
+
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3));
cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO1_OID "\n" OCTO1_OID "\n"));
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branches '" OCTO1_BRANCH "', '" OCTO1_BRANCH "' and '" OCTO1_BRANCH "'\n"));
-
+
git_reference_free(octo1_1_ref);
git_reference_free(octo1_2_ref);
git_reference_free(octo1_3_ref);
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
git_annotated_commit_free(their_heads[1]);
@@ -434,26 +434,26 @@ void test_merge_workdir_setup__three_same_oids(void)
git_oid octo1_2_oid;
git_oid octo1_3_oid;
git_annotated_commit *our_head, *their_heads[3];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
-
+
cl_git_pass(git_oid_fromstr(&octo1_1_oid, OCTO1_OID));
cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_1_oid));
-
+
cl_git_pass(git_oid_fromstr(&octo1_2_oid, OCTO1_OID));
cl_git_pass(git_annotated_commit_lookup(&their_heads[1], repo, &octo1_2_oid));
-
+
cl_git_pass(git_oid_fromstr(&octo1_3_oid, OCTO1_OID));
cl_git_pass(git_annotated_commit_lookup(&their_heads[2], repo, &octo1_3_oid));
-
+
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3));
-
+
cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO1_OID "\n" OCTO1_OID "\n"));
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge commit '" OCTO1_OID "'; commit '" OCTO1_OID "'; commit '" OCTO1_OID "'\n"));
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
git_annotated_commit_free(their_heads[1]);
@@ -473,7 +473,7 @@ static int create_remote_tracking_branch(const char *branch_name, const char *oi
(error = git_str_puts(&remotes_path, GIT_REFS_REMOTES_DIR)) < 0)
goto done;
- if (!git_path_exists(git_str_cstr(&remotes_path)) &&
+ if (!git_fs_path_exists(git_str_cstr(&remotes_path)) &&
(error = p_mkdir(git_str_cstr(&remotes_path), 0777)) < 0)
goto done;
@@ -481,7 +481,7 @@ static int create_remote_tracking_branch(const char *branch_name, const char *oi
(error = git_str_puts(&origin_path, "origin")) < 0)
goto done;
- if (!git_path_exists(git_str_cstr(&origin_path)) &&
+ if (!git_fs_path_exists(git_str_cstr(&origin_path)) &&
(error = p_mkdir(git_str_cstr(&origin_path), 0777)) < 0)
goto done;
@@ -514,10 +514,10 @@ void test_merge_workdir_setup__remote_tracking_one_branch(void)
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
-
+
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
-
+
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 1));
cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n"));
@@ -526,7 +526,7 @@ void test_merge_workdir_setup__remote_tracking_one_branch(void)
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge remote-tracking branch 'refs/remotes/origin/" OCTO1_BRANCH "'\n"));
git_reference_free(octo1_ref);
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
}
@@ -544,7 +544,7 @@ void test_merge_workdir_setup__remote_tracking_two_branches(void)
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
-
+
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
@@ -552,15 +552,15 @@ void test_merge_workdir_setup__remote_tracking_two_branches(void)
cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 2));
-
+
cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n"));
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge remote-tracking branches 'refs/remotes/origin/" OCTO1_BRANCH "' and 'refs/remotes/origin/" OCTO2_BRANCH "'\n"));
-
+
git_reference_free(octo1_ref);
git_reference_free(octo2_ref);
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
git_annotated_commit_free(their_heads[1]);
@@ -578,13 +578,13 @@ void test_merge_workdir_setup__remote_tracking_three_branches(void)
cl_git_pass(create_remote_tracking_branch(OCTO1_BRANCH, OCTO1_OID));
cl_git_pass(create_remote_tracking_branch(OCTO2_BRANCH, OCTO2_OID));
cl_git_pass(create_remote_tracking_branch(OCTO3_BRANCH, OCTO3_OID));
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
-
+
cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO2_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref));
@@ -597,7 +597,7 @@ void test_merge_workdir_setup__remote_tracking_three_branches(void)
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge remote-tracking branches 'refs/remotes/origin/" OCTO1_BRANCH "', 'refs/remotes/origin/" OCTO2_BRANCH "' and 'refs/remotes/origin/" OCTO3_BRANCH "'\n"));
-
+
git_reference_free(octo1_ref);
git_reference_free(octo2_ref);
git_reference_free(octo3_ref);
@@ -628,15 +628,15 @@ void test_merge_workdir_setup__normal_branch_and_remote_tracking_branch(void)
cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 2));
-
+
cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n"));
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branch '" OCTO1_BRANCH "', remote-tracking branch 'refs/remotes/origin/" OCTO2_BRANCH "'\n"));
-
+
git_reference_free(octo1_ref);
git_reference_free(octo2_ref);
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
git_annotated_commit_free(their_heads[1]);
@@ -654,7 +654,7 @@ void test_merge_workdir_setup__remote_tracking_branch_and_normal_branch(void)
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
-
+
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
@@ -662,15 +662,15 @@ void test_merge_workdir_setup__remote_tracking_branch_and_normal_branch(void)
cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 2));
-
+
cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n"));
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branch '" OCTO2_BRANCH "', remote-tracking branch 'refs/remotes/origin/" OCTO1_BRANCH "'\n"));
-
+
git_reference_free(octo1_ref);
git_reference_free(octo2_ref);
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
git_annotated_commit_free(their_heads[1]);
@@ -691,7 +691,7 @@ void test_merge_workdir_setup__two_remote_tracking_branch_and_two_normal_branche
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
-
+
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
@@ -705,17 +705,17 @@ void test_merge_workdir_setup__two_remote_tracking_branch_and_two_normal_branche
cl_git_pass(git_annotated_commit_from_ref(&their_heads[3], repo, octo4_ref));
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 4));
-
+
cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n" OCTO4_OID "\n"));
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branches '" OCTO1_BRANCH "' and '" OCTO3_BRANCH "', remote-tracking branches 'refs/remotes/origin/" OCTO2_BRANCH "' and 'refs/remotes/origin/" OCTO4_BRANCH "'\n"));
-
+
git_reference_free(octo1_ref);
git_reference_free(octo2_ref);
git_reference_free(octo3_ref);
git_reference_free(octo4_ref);
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
git_annotated_commit_free(their_heads[1]);
@@ -735,14 +735,14 @@ void test_merge_workdir_setup__pull_one(void)
cl_git_pass(git_oid_fromstr(&octo1_1_oid, OCTO1_OID));
cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &octo1_1_oid));
-
+
cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 1));
-
+
cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n"));
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branch 'octo1' of http://remote.url/repo.git\n"));
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
}
@@ -754,7 +754,7 @@ void test_merge_workdir_setup__pull_two(void)
git_oid octo1_oid;
git_oid octo2_oid;
git_annotated_commit *our_head, *their_heads[2];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
@@ -770,7 +770,7 @@ void test_merge_workdir_setup__pull_two(void)
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branches '" OCTO1_BRANCH "' and '" OCTO2_BRANCH "' of http://remote.url/repo.git\n"));
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
git_annotated_commit_free(their_heads[1]);
@@ -784,7 +784,7 @@ void test_merge_workdir_setup__pull_three(void)
git_oid octo2_oid;
git_oid octo3_oid;
git_annotated_commit *our_head, *their_heads[3];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
@@ -803,7 +803,7 @@ void test_merge_workdir_setup__pull_three(void)
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branches '" OCTO1_BRANCH "', '" OCTO2_BRANCH "' and '" OCTO3_BRANCH "' of http://remote.url/repo.git\n"));
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
git_annotated_commit_free(their_heads[1]);
@@ -817,7 +817,7 @@ void test_merge_workdir_setup__three_remotes(void)
git_oid octo2_oid;
git_oid octo3_oid;
git_annotated_commit *our_head, *their_heads[3];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
@@ -836,7 +836,7 @@ void test_merge_workdir_setup__three_remotes(void)
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branch '" OCTO1_BRANCH "' of http://remote.first/repo.git, branch '" OCTO2_BRANCH "' of http://remote.second/repo.git, branch '" OCTO3_BRANCH "' of http://remote.third/repo.git\n"));
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
git_annotated_commit_free(their_heads[1]);
@@ -851,7 +851,7 @@ void test_merge_workdir_setup__two_remotes(void)
git_oid octo3_oid;
git_oid octo4_oid;
git_annotated_commit *our_head, *their_heads[4];
-
+
cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD));
cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid));
@@ -873,7 +873,7 @@ void test_merge_workdir_setup__two_remotes(void)
cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n"));
cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff"));
cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branches '" OCTO1_BRANCH "' and '" OCTO3_BRANCH "' of http://remote.first/repo.git, branches '" OCTO2_BRANCH "' and '" OCTO4_BRANCH "' of http://remote.second/repo.git\n"));
-
+
git_annotated_commit_free(our_head);
git_annotated_commit_free(their_heads[0]);
git_annotated_commit_free(their_heads[1]);
@@ -1036,9 +1036,9 @@ void test_merge_workdir_setup__removed_after_failure(void)
cl_git_fail(git_merge(
repo, (const git_annotated_commit **)&their_heads[0], 1, NULL, NULL));
- cl_assert(!git_path_exists("merge-resolve/.git/" GIT_MERGE_HEAD_FILE));
- cl_assert(!git_path_exists("merge-resolve/.git/" GIT_MERGE_MODE_FILE));
- cl_assert(!git_path_exists("merge-resolve/.git/" GIT_MERGE_MSG_FILE));
+ cl_assert(!git_fs_path_exists("merge-resolve/.git/" GIT_MERGE_HEAD_FILE));
+ cl_assert(!git_fs_path_exists("merge-resolve/.git/" GIT_MERGE_MODE_FILE));
+ cl_assert(!git_fs_path_exists("merge-resolve/.git/" GIT_MERGE_MSG_FILE));
git_reference_free(octo1_ref);
@@ -1061,7 +1061,7 @@ void test_merge_workdir_setup__unlocked_after_success(void)
cl_git_pass(git_merge(
repo, (const git_annotated_commit **)&their_heads[0], 1, NULL, NULL));
- cl_assert(!git_path_exists("merge-resolve/.git/index.lock"));
+ cl_assert(!git_fs_path_exists("merge-resolve/.git/index.lock"));
git_reference_free(octo1_ref);
@@ -1087,7 +1087,7 @@ void test_merge_workdir_setup__unlocked_after_conflict(void)
cl_git_fail(git_merge(
repo, (const git_annotated_commit **)&their_heads[0], 1, NULL, NULL));
- cl_assert(!git_path_exists("merge-resolve/.git/index.lock"));
+ cl_assert(!git_fs_path_exists("merge-resolve/.git/index.lock"));
git_reference_free(octo1_ref);
diff --git a/tests/merge/workdir/simple.c b/tests/merge/workdir/simple.c
index 6c4cf7e3c..f51ff09a7 100644
--- a/tests/merge/workdir/simple.c
+++ b/tests/merge/workdir/simple.c
@@ -504,7 +504,7 @@ void test_merge_workdir_simple__checkout_ours(void)
cl_assert(merge_test_index(repo_index, merge_index_entries, 8));
cl_assert(merge_test_reuc(repo_index, merge_reuc_entries, 3));
- cl_assert(git_path_exists(TEST_REPO_PATH "/conflicting.txt"));
+ cl_assert(git_fs_path_exists(TEST_REPO_PATH "/conflicting.txt"));
}
void test_merge_workdir_simple__favor_ours(void)
diff --git a/tests/object/blob/write.c b/tests/object/blob/write.c
index 802467498..422258d63 100644
--- a/tests/object/blob/write.c
+++ b/tests/object/blob/write.c
@@ -42,7 +42,7 @@ void test_object_blob_write__can_create_a_blob_in_a_standard_repo_from_a_absolut
repo = cl_git_sandbox_init(WORKDIR);
cl_must_pass(p_mkdir(ELSEWHERE, 0777));
- cl_must_pass(git_path_prettify_dir(&full_path, ELSEWHERE, NULL));
+ cl_must_pass(git_fs_path_prettify_dir(&full_path, ELSEWHERE, NULL));
cl_must_pass(git_str_puts(&full_path, "test.txt"));
assert_blob_creation(ELSEWHERE "/test.txt", git_str_cstr(&full_path), &git_blob_create_from_disk);
@@ -58,7 +58,7 @@ void test_object_blob_write__can_create_a_blob_in_a_bare_repo_from_a_absolute_fi
repo = cl_git_sandbox_init(BARE_REPO);
cl_must_pass(p_mkdir(ELSEWHERE, 0777));
- cl_must_pass(git_path_prettify_dir(&full_path, ELSEWHERE, NULL));
+ cl_must_pass(git_fs_path_prettify_dir(&full_path, ELSEWHERE, NULL));
cl_must_pass(git_str_puts(&full_path, "test.txt"));
assert_blob_creation(ELSEWHERE "/test.txt", git_str_cstr(&full_path), &git_blob_create_from_disk);
diff --git a/tests/object/raw/write.c b/tests/object/raw/write.c
index 9bc127680..40e05f357 100644
--- a/tests/object/raw/write.c
+++ b/tests/object/raw/write.c
@@ -39,8 +39,8 @@ static void streaming_write(git_oid *oid, git_odb *odb, git_rawobj *raw)
static void check_object_files(object_data *d)
{
- cl_assert(git_path_exists(d->dir));
- cl_assert(git_path_exists(d->file));
+ cl_assert(git_fs_path_exists(d->dir));
+ cl_assert(git_fs_path_exists(d->file));
}
static void cmp_objects(git_rawobj *o1, git_rawobj *o2)
diff --git a/tests/odb/alternates.c b/tests/odb/alternates.c
index e36010b75..6c00fda2f 100644
--- a/tests/odb/alternates.c
+++ b/tests/odb/alternates.c
@@ -26,7 +26,7 @@ static void init_linked_repo(const char *path, const char *alternate)
git_str_clear(&filepath);
cl_git_pass(git_repository_init(&repo, path, 1));
- cl_git_pass(git_path_prettify(&destpath, alternate, NULL));
+ cl_git_pass(git_fs_path_prettify(&destpath, alternate, NULL));
cl_git_pass(git_str_joinpath(&destpath, destpath.ptr, "objects"));
cl_git_pass(git_str_joinpath(&filepath, git_repository_path(repo), "objects/info"));
cl_git_pass(git_futils_mkdir(filepath.ptr, 0755, GIT_MKDIR_PATH));
diff --git a/tests/odb/emptyobjects.c b/tests/odb/emptyobjects.c
index 89b22ad4a..e3ec62d3f 100644
--- a/tests/odb/emptyobjects.c
+++ b/tests/odb/emptyobjects.c
@@ -28,7 +28,7 @@ void test_odb_emptyobjects__blob_notfound(void)
cl_git_fail_with(GIT_ENOTFOUND, git_blob_lookup(&blob, g_repo, &id));
cl_git_pass(git_odb_write(&written_id, g_odb, "", 0, GIT_OBJECT_BLOB));
- cl_assert(git_path_exists(TEST_REPO_PATH "/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391"));
+ cl_assert(git_fs_path_exists(TEST_REPO_PATH "/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391"));
}
void test_odb_emptyobjects__read_tree(void)
diff --git a/tests/online/clone.c b/tests/online/clone.c
index c55cf9f95..ba88dff9c 100644
--- a/tests/online/clone.c
+++ b/tests/online/clone.c
@@ -194,7 +194,7 @@ void test_online_clone__can_checkout_a_cloned_repo(void)
cl_git_pass(git_clone(&g_repo, LIVE_REPO_URL, "./foo", &g_options));
cl_git_pass(git_str_joinpath(&path, git_repository_workdir(g_repo), "master.txt"));
- cl_assert_equal_i(true, git_path_isfile(git_str_cstr(&path)));
+ cl_assert_equal_i(true, git_fs_path_isfile(git_str_cstr(&path)));
cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD"));
cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head));
@@ -930,11 +930,11 @@ void test_online_clone__proxy_cred_callback_after_failed_url_creds(void)
void test_online_clone__azurerepos(void)
{
cl_git_pass(git_clone(&g_repo, "https://libgit2@dev.azure.com/libgit2/test/_git/test", "./foo", &g_options));
- cl_assert(git_path_exists("./foo/master.txt"));
+ cl_assert(git_fs_path_exists("./foo/master.txt"));
}
void test_online_clone__path_whitespace(void)
{
cl_git_pass(git_clone(&g_repo, "https://libgit2@dev.azure.com/libgit2/test/_git/spaces%20in%20the%20name", "./foo", &g_options));
- cl_assert(git_path_exists("./foo/master.txt"));
+ cl_assert(git_fs_path_exists("./foo/master.txt"));
}
diff --git a/tests/online/customcert.c b/tests/online/customcert.c
index 098212b14..7932a9e68 100644
--- a/tests/online/customcert.c
+++ b/tests/online/customcert.c
@@ -66,7 +66,7 @@ void test_online_customcert__file(void)
{
#if (GIT_OPENSSL || GIT_MBEDTLS)
cl_git_pass(git_clone(&g_repo, CUSTOM_CERT_ONE_URL, "./cloned", NULL));
- cl_assert(git_path_exists("./cloned/master.txt"));
+ cl_assert(git_fs_path_exists("./cloned/master.txt"));
#endif
}
@@ -74,6 +74,6 @@ void test_online_customcert__path(void)
{
#if (GIT_OPENSSL || GIT_MBEDTLS)
cl_git_pass(git_clone(&g_repo, CUSTOM_CERT_TWO_URL, "./cloned", NULL));
- cl_assert(git_path_exists("./cloned/master.txt"));
+ cl_assert(git_fs_path_exists("./cloned/master.txt"));
#endif
}
diff --git a/tests/pack/indexer.c b/tests/pack/indexer.c
index 5958bc4ba..954bee953 100644
--- a/tests/pack/indexer.c
+++ b/tests/pack/indexer.c
@@ -289,7 +289,7 @@ static int find_tmp_file_recurs(void *opaque, git_str *path)
return error;
if (S_ISDIR(st.st_mode))
- return git_path_direach(path, 0, find_tmp_file_recurs, opaque);
+ return git_fs_path_direach(path, 0, find_tmp_file_recurs, opaque);
/* This is the template that's used in git_futils_mktmp. */
if (strstr(git_str_cstr(path), "_git2_") != NULL)
diff --git a/tests/pack/packbuilder.c b/tests/pack/packbuilder.c
index b4c655c5e..5b1f7b9e9 100644
--- a/tests/pack/packbuilder.c
+++ b/tests/pack/packbuilder.c
@@ -156,8 +156,8 @@ void test_pack_packbuilder__write_default_path(void)
seed_packbuilder();
cl_git_pass(git_packbuilder_write(_packbuilder, NULL, 0, NULL, NULL));
- cl_assert(git_path_exists("objects/pack/pack-7f5fa362c664d68ba7221259be1cbd187434b2f0.idx"));
- cl_assert(git_path_exists("objects/pack/pack-7f5fa362c664d68ba7221259be1cbd187434b2f0.pack"));
+ cl_assert(git_fs_path_exists("objects/pack/pack-7f5fa362c664d68ba7221259be1cbd187434b2f0.idx"));
+ cl_assert(git_fs_path_exists("objects/pack/pack-7f5fa362c664d68ba7221259be1cbd187434b2f0.pack"));
}
static void test_write_pack_permission(mode_t given, mode_t expected)
diff --git a/tests/path/core.c b/tests/path/core.c
index 1d6066933..9421941c0 100644
--- a/tests/path/core.c
+++ b/tests/path/core.c
@@ -1,4 +1,5 @@
#include "clar_libgit2.h"
+#include "fs_path.h"
#include "path.h"
void test_path_core__cleanup(void)
@@ -14,7 +15,7 @@ static void test_make_relative(
{
git_str buf = GIT_STR_INIT;
git_str_puts(&buf, path);
- cl_assert_equal_i(expected_status, git_path_make_relative(&buf, parent));
+ cl_assert_equal_i(expected_status, git_fs_path_make_relative(&buf, parent));
cl_assert_equal_s(expected_path, buf.ptr);
git_str_dispose(&buf);
}
@@ -59,284 +60,252 @@ void test_path_core__make_relative(void)
void test_path_core__isvalid_standard(void)
{
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/bar", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/bar/file.txt", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/bar/.file", 0, 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo/bar", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo/bar/file.txt", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo/bar/.file", 0));
+}
+
+/* Ensure that `is_valid_str` only reads str->size bytes */
+void test_path_core__isvalid_standard_str(void)
+{
+ git_str str = GIT_STR_INIT_CONST("foo/bar//zap", 0);
+ unsigned int flags = GIT_FS_PATH_REJECT_EMPTY_COMPONENT;
+
+ str.size = 0;
+ cl_assert_equal_b(false, git_fs_path_str_is_valid(&str, flags));
+
+ str.size = 3;
+ cl_assert_equal_b(true, git_fs_path_str_is_valid(&str, flags));
+
+ str.size = 4;
+ cl_assert_equal_b(false, git_fs_path_str_is_valid(&str, flags));
+
+ str.size = 5;
+ cl_assert_equal_b(true, git_fs_path_str_is_valid(&str, flags));
+
+ str.size = 7;
+ cl_assert_equal_b(true, git_fs_path_str_is_valid(&str, flags));
+
+ str.size = 8;
+ cl_assert_equal_b(false, git_fs_path_str_is_valid(&str, flags));
+
+ str.size = strlen(str.ptr);
+ cl_assert_equal_b(false, git_fs_path_str_is_valid(&str, flags));
}
void test_path_core__isvalid_empty_dir_component(void)
{
- cl_assert_equal_b(false, git_path_validate(NULL, "foo//bar", 0, 0));
+ unsigned int flags = GIT_FS_PATH_REJECT_EMPTY_COMPONENT;
+
+ /* empty component */
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo//bar", 0));
/* leading slash */
- cl_assert_equal_b(false, git_path_validate(NULL, "/", 0, 0));
- cl_assert_equal_b(false, git_path_validate(NULL, "/foo", 0, 0));
- cl_assert_equal_b(false, git_path_validate(NULL, "/foo/bar", 0, 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("/", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("/foo", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("/foo/bar", 0));
/* trailing slash */
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/", 0, 0));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/bar/", 0, 0));
-}
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo/", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo/bar/", 0));
-void test_path_core__isvalid_dot_and_dotdot(void)
-{
- cl_assert_equal_b(true, git_path_validate(NULL, ".", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "./foo", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/.", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "./foo", 0, 0));
-
- cl_assert_equal_b(true, git_path_validate(NULL, "..", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "../foo", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/..", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "../foo", 0, 0));
-
- cl_assert_equal_b(false, git_path_validate(NULL, ".", 0, GIT_PATH_REJECT_TRAVERSAL));
- cl_assert_equal_b(false, git_path_validate(NULL, "./foo", 0, GIT_PATH_REJECT_TRAVERSAL));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/.", 0, GIT_PATH_REJECT_TRAVERSAL));
- cl_assert_equal_b(false, git_path_validate(NULL, "./foo", 0, GIT_PATH_REJECT_TRAVERSAL));
-
- cl_assert_equal_b(false, git_path_validate(NULL, "..", 0, GIT_PATH_REJECT_TRAVERSAL));
- cl_assert_equal_b(false, git_path_validate(NULL, "../foo", 0, GIT_PATH_REJECT_TRAVERSAL));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/..", 0, GIT_PATH_REJECT_TRAVERSAL));
- cl_assert_equal_b(false, git_path_validate(NULL, "../foo", 0, GIT_PATH_REJECT_TRAVERSAL));
+
+ /* empty component */
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo//bar", flags));
+
+ /* leading slash */
+ cl_assert_equal_b(false, git_fs_path_is_valid("/", flags));
+ cl_assert_equal_b(false, git_fs_path_is_valid("/foo", flags));
+ cl_assert_equal_b(false, git_fs_path_is_valid("/foo/bar", flags));
+
+ /* trailing slash */
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo/", flags));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo/bar/", flags));
}
-void test_path_core__isvalid_dot_git(void)
+void test_path_core__isvalid_dot_and_dotdot(void)
{
- cl_assert_equal_b(true, git_path_validate(NULL, ".git", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, ".git/foo", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/.git", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/.git/bar", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/.GIT/bar", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/bar/.Git", 0, 0));
-
- cl_assert_equal_b(false, git_path_validate(NULL, ".git", 0, GIT_PATH_REJECT_DOT_GIT_LITERAL));
- cl_assert_equal_b(false, git_path_validate(NULL, ".git/foo", 0, GIT_PATH_REJECT_DOT_GIT_LITERAL));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/.git", 0, GIT_PATH_REJECT_DOT_GIT_LITERAL));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/.git/bar", 0, GIT_PATH_REJECT_DOT_GIT_LITERAL));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/.GIT/bar", 0, GIT_PATH_REJECT_DOT_GIT_LITERAL));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/bar/.Git", 0, GIT_PATH_REJECT_DOT_GIT_LITERAL));
-
- cl_assert_equal_b(true, git_path_validate(NULL, "!git", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/!git", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "!git/bar", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, ".tig", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/.tig", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, ".tig/bar", 0, 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid(".", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("./foo", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo/.", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("./foo", 0));
+
+ cl_assert_equal_b(true, git_fs_path_is_valid("..", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("../foo", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo/..", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("../foo", 0));
+
+ cl_assert_equal_b(false, git_fs_path_is_valid(".", GIT_FS_PATH_REJECT_TRAVERSAL));
+ cl_assert_equal_b(false, git_fs_path_is_valid("./foo", GIT_FS_PATH_REJECT_TRAVERSAL));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo/.", GIT_FS_PATH_REJECT_TRAVERSAL));
+ cl_assert_equal_b(false, git_fs_path_is_valid("./foo", GIT_FS_PATH_REJECT_TRAVERSAL));
+
+ cl_assert_equal_b(false, git_fs_path_is_valid("..", GIT_FS_PATH_REJECT_TRAVERSAL));
+ cl_assert_equal_b(false, git_fs_path_is_valid("../foo", GIT_FS_PATH_REJECT_TRAVERSAL));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo/..", GIT_FS_PATH_REJECT_TRAVERSAL));
+ cl_assert_equal_b(false, git_fs_path_is_valid("../foo", GIT_FS_PATH_REJECT_TRAVERSAL));
}
void test_path_core__isvalid_backslash(void)
{
- cl_assert_equal_b(true, git_path_validate(NULL, "foo\\file.txt", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/bar\\file.txt", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/bar\\", 0, 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo\\file.txt", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo/bar\\file.txt", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo/bar\\", 0));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo\\file.txt", 0, GIT_PATH_REJECT_BACKSLASH));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/bar\\file.txt", 0, GIT_PATH_REJECT_BACKSLASH));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/bar\\", 0, GIT_PATH_REJECT_BACKSLASH));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo\\file.txt", GIT_FS_PATH_REJECT_BACKSLASH));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo/bar\\file.txt", GIT_FS_PATH_REJECT_BACKSLASH));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo/bar\\", GIT_FS_PATH_REJECT_BACKSLASH));
}
void test_path_core__isvalid_trailing_dot(void)
{
- cl_assert_equal_b(true, git_path_validate(NULL, "foo.", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo...", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/bar.", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo./bar", 0, 0));
-
- cl_assert_equal_b(false, git_path_validate(NULL, "foo.", 0, GIT_PATH_REJECT_TRAILING_DOT));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo...", 0, GIT_PATH_REJECT_TRAILING_DOT));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/bar.", 0, GIT_PATH_REJECT_TRAILING_DOT));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo./bar", 0, GIT_PATH_REJECT_TRAILING_DOT));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo.", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo...", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo/bar.", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo./bar", 0));
+
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo.", GIT_FS_PATH_REJECT_TRAILING_DOT));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo...", GIT_FS_PATH_REJECT_TRAILING_DOT));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo/bar.", GIT_FS_PATH_REJECT_TRAILING_DOT));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo./bar", GIT_FS_PATH_REJECT_TRAILING_DOT));
}
void test_path_core__isvalid_trailing_space(void)
{
- cl_assert_equal_b(true, git_path_validate(NULL, "foo ", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo ", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/bar ", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, " ", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo /bar", 0, 0));
-
- cl_assert_equal_b(false, git_path_validate(NULL, "foo ", 0, GIT_PATH_REJECT_TRAILING_SPACE));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo ", 0, GIT_PATH_REJECT_TRAILING_SPACE));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/bar ", 0, GIT_PATH_REJECT_TRAILING_SPACE));
- cl_assert_equal_b(false, git_path_validate(NULL, " ", 0, GIT_PATH_REJECT_TRAILING_SPACE));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo /bar", 0, GIT_PATH_REJECT_TRAILING_SPACE));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo ", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo ", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo/bar ", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid(" ", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo /bar", 0));
+
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo ", GIT_FS_PATH_REJECT_TRAILING_SPACE));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo ", GIT_FS_PATH_REJECT_TRAILING_SPACE));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo/bar ", GIT_FS_PATH_REJECT_TRAILING_SPACE));
+ cl_assert_equal_b(false, git_fs_path_is_valid(" ", GIT_FS_PATH_REJECT_TRAILING_SPACE));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo /bar", GIT_FS_PATH_REJECT_TRAILING_SPACE));
}
void test_path_core__isvalid_trailing_colon(void)
{
- cl_assert_equal_b(true, git_path_validate(NULL, "foo:", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo/bar:", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, ":", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "foo:/bar", 0, 0));
-
- cl_assert_equal_b(false, git_path_validate(NULL, "foo:", 0, GIT_PATH_REJECT_TRAILING_COLON));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo/bar:", 0, GIT_PATH_REJECT_TRAILING_COLON));
- cl_assert_equal_b(false, git_path_validate(NULL, ":", 0, GIT_PATH_REJECT_TRAILING_COLON));
- cl_assert_equal_b(false, git_path_validate(NULL, "foo:/bar", 0, GIT_PATH_REJECT_TRAILING_COLON));
-}
-
-void test_path_core__isvalid_dotgit_ntfs(void)
-{
- cl_assert_equal_b(true, git_path_validate(NULL, ".git", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, ".git ", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, ".git.", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, ".git.. .", 0, 0));
-
- cl_assert_equal_b(true, git_path_validate(NULL, "git~1", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "git~1 ", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "git~1.", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "git~1.. .", 0, 0));
-
- cl_assert_equal_b(false, git_path_validate(NULL, ".git", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
- cl_assert_equal_b(false, git_path_validate(NULL, ".git ", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
- cl_assert_equal_b(false, git_path_validate(NULL, ".git.", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
- cl_assert_equal_b(false, git_path_validate(NULL, ".git.. .", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
-
- cl_assert_equal_b(false, git_path_validate(NULL, "git~1", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
- cl_assert_equal_b(false, git_path_validate(NULL, "git~1 ", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
- cl_assert_equal_b(false, git_path_validate(NULL, "git~1.", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
- cl_assert_equal_b(false, git_path_validate(NULL, "git~1.. .", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo:", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo/bar:", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid(":", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("foo:/bar", 0));
+
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo:", GIT_FS_PATH_REJECT_TRAILING_COLON));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo/bar:", GIT_FS_PATH_REJECT_TRAILING_COLON));
+ cl_assert_equal_b(false, git_fs_path_is_valid(":", GIT_FS_PATH_REJECT_TRAILING_COLON));
+ cl_assert_equal_b(false, git_fs_path_is_valid("foo:/bar", GIT_FS_PATH_REJECT_TRAILING_COLON));
}
void test_path_core__isvalid_dos_paths(void)
{
- cl_assert_equal_b(true, git_path_validate(NULL, "aux", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "aux.", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "aux:", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "aux.asdf", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "aux.asdf\\zippy", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "aux:asdf\\foobar", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "con", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "prn", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "nul", 0, 0));
-
- cl_assert_equal_b(false, git_path_validate(NULL, "aux", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "aux.", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "aux:", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "aux.asdf", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "aux.asdf\\zippy", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "aux:asdf\\foobar", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "con", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "prn", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "nul", 0, GIT_PATH_REJECT_DOS_PATHS));
-
- cl_assert_equal_b(true, git_path_validate(NULL, "aux1", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "aux1", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(true, git_path_validate(NULL, "auxn", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(true, git_path_validate(NULL, "aux\\foo", 0, GIT_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(true, git_fs_path_is_valid("aux", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("aux.", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("aux:", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("aux.asdf", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("aux.asdf\\zippy", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("aux:asdf\\foobar", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("con", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("prn", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("nul", 0));
+
+ cl_assert_equal_b(false, git_fs_path_is_valid("aux", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("aux.", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("aux:", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("aux.asdf", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("aux.asdf\\zippy", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("aux:asdf\\foobar", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("con", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("prn", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("nul", GIT_FS_PATH_REJECT_DOS_PATHS));
+
+ cl_assert_equal_b(true, git_fs_path_is_valid("aux1", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("aux1", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(true, git_fs_path_is_valid("auxn", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(true, git_fs_path_is_valid("aux\\foo", GIT_FS_PATH_REJECT_DOS_PATHS));
}
void test_path_core__isvalid_dos_paths_withnum(void)
{
- cl_assert_equal_b(true, git_path_validate(NULL, "com1", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "com1.", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "com1:", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "com1.asdf", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "com1.asdf\\zippy", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "com1:asdf\\foobar", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "com1\\foo", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "lpt1", 0, 0));
-
- cl_assert_equal_b(false, git_path_validate(NULL, "com1", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "com1.", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "com1:", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "com1.asdf", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "com1.asdf\\zippy", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "com1:asdf\\foobar", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "com1/foo", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(false, git_path_validate(NULL, "lpt1", 0, GIT_PATH_REJECT_DOS_PATHS));
-
- cl_assert_equal_b(true, git_path_validate(NULL, "com0", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "com0", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(true, git_path_validate(NULL, "com10", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "com10", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(true, git_path_validate(NULL, "comn", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(true, git_path_validate(NULL, "com1\\foo", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(true, git_path_validate(NULL, "lpt0", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(true, git_path_validate(NULL, "lpt10", 0, GIT_PATH_REJECT_DOS_PATHS));
- cl_assert_equal_b(true, git_path_validate(NULL, "lptn", 0, GIT_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(true, git_fs_path_is_valid("com1", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("com1.", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("com1:", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("com1.asdf", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("com1.asdf\\zippy", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("com1:asdf\\foobar", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("com1\\foo", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("lpt1", 0));
+
+ cl_assert_equal_b(false, git_fs_path_is_valid("com1", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("com1.", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("com1:", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("com1.asdf", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("com1.asdf\\zippy", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("com1:asdf\\foobar", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("com1/foo", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("lpt1", GIT_FS_PATH_REJECT_DOS_PATHS));
+
+ cl_assert_equal_b(true, git_fs_path_is_valid("com0", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("com0", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(true, git_fs_path_is_valid("com10", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("com10", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(true, git_fs_path_is_valid("comn", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(true, git_fs_path_is_valid("com1\\foo", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(true, git_fs_path_is_valid("lpt0", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(true, git_fs_path_is_valid("lpt10", GIT_FS_PATH_REJECT_DOS_PATHS));
+ cl_assert_equal_b(true, git_fs_path_is_valid("lptn", GIT_FS_PATH_REJECT_DOS_PATHS));
}
void test_path_core__isvalid_nt_chars(void)
{
- cl_assert_equal_b(true, git_path_validate(NULL, "asdf\001foo", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "asdf\037bar", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "asdf<bar", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "asdf>foo", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "asdf:foo", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "asdf\"bar", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "asdf|foo", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "asdf?bar", 0, 0));
- cl_assert_equal_b(true, git_path_validate(NULL, "asdf*bar", 0, 0));
-
- cl_assert_equal_b(false, git_path_validate(NULL, "asdf\001foo", 0, GIT_PATH_REJECT_NT_CHARS));
- cl_assert_equal_b(false, git_path_validate(NULL, "asdf\037bar", 0, GIT_PATH_REJECT_NT_CHARS));
- cl_assert_equal_b(false, git_path_validate(NULL, "asdf<bar", 0, GIT_PATH_REJECT_NT_CHARS));
- cl_assert_equal_b(false, git_path_validate(NULL, "asdf>foo", 0, GIT_PATH_REJECT_NT_CHARS));
- cl_assert_equal_b(false, git_path_validate(NULL, "asdf:foo", 0, GIT_PATH_REJECT_NT_CHARS));
- cl_assert_equal_b(false, git_path_validate(NULL, "asdf\"bar", 0, GIT_PATH_REJECT_NT_CHARS));
- cl_assert_equal_b(false, git_path_validate(NULL, "asdf|foo", 0, GIT_PATH_REJECT_NT_CHARS));
- cl_assert_equal_b(false, git_path_validate(NULL, "asdf?bar", 0, GIT_PATH_REJECT_NT_CHARS));
- cl_assert_equal_b(false, git_path_validate(NULL, "asdf*bar", 0, GIT_PATH_REJECT_NT_CHARS));
-}
-
-void test_path_core__isvalid_dotgit_with_hfs_ignorables(void)
-{
- cl_assert_equal_b(false, git_path_validate(NULL, ".git", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(false, git_path_validate(NULL, ".git\xe2\x80\x8c", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(false, git_path_validate(NULL, ".gi\xe2\x80\x8dT", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(false, git_path_validate(NULL, ".g\xe2\x80\x8eIt", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(false, git_path_validate(NULL, ".\xe2\x80\x8fgIt", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(false, git_path_validate(NULL, "\xe2\x80\xaa.gIt", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
-
- cl_assert_equal_b(false, git_path_validate(NULL, "\xe2\x80\xab.\xe2\x80\xacG\xe2\x80\xadI\xe2\x80\xaet", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(false, git_path_validate(NULL, "\xe2\x81\xab.\xe2\x80\xaaG\xe2\x81\xabI\xe2\x80\xact", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(false, git_path_validate(NULL, "\xe2\x81\xad.\xe2\x80\xaeG\xef\xbb\xbfIT", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
-
- cl_assert_equal_b(true, git_path_validate(NULL, ".", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, ".g", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, ".gi", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, " .git", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, "..git\xe2\x80\x8c", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, ".gi\xe2\x80\x8dT.", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, ".g\xe2\x80It", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, ".\xe2gIt", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, "\xe2\x80\xaa.gi", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, ".gi\x80\x8dT", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, ".gi\x8dT", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, ".g\xe2i\x80T\x8e", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, ".git\xe2\x80\xbf", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(true, git_path_validate(NULL, ".git\xe2\xab\x81", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_fs_path_is_valid("asdf\001foo", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("asdf\037bar", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("asdf<bar", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("asdf>foo", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("asdf:foo", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("asdf\"bar", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("asdf|foo", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("asdf?bar", 0));
+ cl_assert_equal_b(true, git_fs_path_is_valid("asdf*bar", 0));
+
+ cl_assert_equal_b(false, git_fs_path_is_valid("asdf\001foo", GIT_FS_PATH_REJECT_NT_CHARS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("asdf\037bar", GIT_FS_PATH_REJECT_NT_CHARS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("asdf<bar", GIT_FS_PATH_REJECT_NT_CHARS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("asdf>foo", GIT_FS_PATH_REJECT_NT_CHARS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("asdf:foo", GIT_FS_PATH_REJECT_NT_CHARS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("asdf\"bar", GIT_FS_PATH_REJECT_NT_CHARS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("asdf|foo", GIT_FS_PATH_REJECT_NT_CHARS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("asdf?bar", GIT_FS_PATH_REJECT_NT_CHARS));
+ cl_assert_equal_b(false, git_fs_path_is_valid("asdf*bar", GIT_FS_PATH_REJECT_NT_CHARS));
}
void test_path_core__validate_workdir(void)
{
- cl_must_pass(git_path_validate_workdir(NULL, "/foo/bar"));
- cl_must_pass(git_path_validate_workdir(NULL, "C:\\Foo\\Bar"));
- cl_must_pass(git_path_validate_workdir(NULL, "\\\\?\\C:\\Foo\\Bar"));
- cl_must_pass(git_path_validate_workdir(NULL, "\\\\?\\C:\\Foo\\Bar"));
- cl_must_pass(git_path_validate_workdir(NULL, "\\\\?\\UNC\\server\\C$\\folder"));
+ cl_must_pass(git_path_validate_length(NULL, "/foo/bar"));
+ cl_must_pass(git_path_validate_length(NULL, "C:\\Foo\\Bar"));
+ cl_must_pass(git_path_validate_length(NULL, "\\\\?\\C:\\Foo\\Bar"));
+ cl_must_pass(git_path_validate_length(NULL, "\\\\?\\C:\\Foo\\Bar"));
+ cl_must_pass(git_path_validate_length(NULL, "\\\\?\\UNC\\server\\C$\\folder"));
#ifdef GIT_WIN32
/*
* In the absense of a repo configuration, 259 character paths
* succeed. >= 260 character paths fail.
*/
- cl_must_pass(git_path_validate_workdir(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\ok.txt"));
- cl_must_pass(git_path_validate_workdir(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\260.txt"));
- cl_must_fail(git_path_validate_workdir(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\longer_than_260.txt"));
+ cl_must_pass(git_path_validate_length(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\ok.txt"));
+ cl_must_pass(git_path_validate_length(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\260.txt"));
+ cl_must_fail(git_path_validate_length(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\longer_than_260.txt"));
/* count characters, not bytes */
- cl_must_pass(git_path_validate_workdir(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\\260.txt"));
- cl_must_fail(git_path_validate_workdir(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\\long.txt"));
+ cl_must_pass(git_path_validate_length(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\\260.txt"));
+ cl_must_fail(git_path_validate_length(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\\long.txt"));
#else
- cl_must_pass(git_path_validate_workdir(NULL, "/c/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/ok.txt"));
- cl_must_pass(git_path_validate_workdir(NULL, "/c/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/260.txt"));
- cl_must_pass(git_path_validate_workdir(NULL, "/c/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/longer_than_260.txt"));
- cl_must_pass(git_path_validate_workdir(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\\260.txt"));
- cl_must_pass(git_path_validate_workdir(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\\long.txt"));
+ cl_must_pass(git_path_validate_length(NULL, "/c/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/ok.txt"));
+ cl_must_pass(git_path_validate_length(NULL, "/c/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/260.txt"));
+ cl_must_pass(git_path_validate_length(NULL, "/c/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/longer_than_260.txt"));
+ cl_must_pass(git_path_validate_length(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\\260.txt"));
+ cl_must_pass(git_path_validate_length(NULL, "C:\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\aaaaaaaaa\\\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\xc2\xa2\\long.txt"));
#endif
}
@@ -352,15 +321,15 @@ void test_path_core__validate_workdir_with_core_longpath(void)
cl_git_pass(git_repository_config(&config, repo));
/* fail by default */
- cl_must_fail(git_path_validate_workdir(repo, "/c/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/longer_than_260.txt"));
+ cl_must_fail(git_path_validate_length(repo, "/c/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/longer_than_260.txt"));
/* set core.longpaths explicitly on */
cl_git_pass(git_config_set_bool(config, "core.longpaths", 1));
- cl_must_pass(git_path_validate_workdir(repo, "/c/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/longer_than_260.txt"));
+ cl_must_pass(git_path_validate_length(repo, "/c/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/longer_than_260.txt"));
/* set core.longpaths explicitly off */
cl_git_pass(git_config_set_bool(config, "core.longpaths", 0));
- cl_must_fail(git_path_validate_workdir(repo, "/c/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/longer_than_260.txt"));
+ cl_must_fail(git_path_validate_length(repo, "/c/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/aaaaaaaaa/longer_than_260.txt"));
git_config_free(config);
git_repository_free(repo);
@@ -376,7 +345,7 @@ static void test_join_unrooted(
git_str result = GIT_STR_INIT;
ssize_t root_at;
- cl_git_pass(git_path_join_unrooted(&result, path, base, &root_at));
+ cl_git_pass(git_fs_path_join_unrooted(&result, path, base, &root_at));
cl_assert_equal_s(expected_result, result.ptr);
cl_assert_equal_i(expected_rootlen, root_at);
diff --git a/tests/path/dotgit.c b/tests/path/dotgit.c
index 2f9fcae4f..9ac68b0ff 100644
--- a/tests/path/dotgit.c
+++ b/tests/path/dotgit.c
@@ -1,4 +1,5 @@
#include "clar_libgit2.h"
+
#include "path.h"
static char *gitmodules_altnames[] = {
@@ -113,8 +114,93 @@ void test_path_dotgit__dotgit_modules(void)
void test_path_dotgit__dotgit_modules_symlink(void)
{
- cl_assert_equal_b(true, git_path_validate(NULL, ".gitmodules", 0, GIT_PATH_REJECT_DOT_GIT_HFS|GIT_PATH_REJECT_DOT_GIT_NTFS));
- cl_assert_equal_b(false, git_path_validate(NULL, ".gitmodules", S_IFLNK, GIT_PATH_REJECT_DOT_GIT_HFS));
- cl_assert_equal_b(false, git_path_validate(NULL, ".gitmodules", S_IFLNK, GIT_PATH_REJECT_DOT_GIT_NTFS));
- cl_assert_equal_b(false, git_path_validate(NULL, ".gitmodules . .::$DATA", S_IFLNK, GIT_PATH_REJECT_DOT_GIT_NTFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".gitmodules", 0, GIT_PATH_REJECT_DOT_GIT_HFS|GIT_PATH_REJECT_DOT_GIT_NTFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".gitmodules", S_IFLNK, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".gitmodules", S_IFLNK, GIT_PATH_REJECT_DOT_GIT_NTFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".gitmodules . .::$DATA", S_IFLNK, GIT_PATH_REJECT_DOT_GIT_NTFS));
+}
+
+void test_core_path__git_fs_path_is_file(void)
+{
+ cl_git_fail(git_path_is_gitfile("blob", 4, -1, GIT_PATH_FS_HFS));
+ cl_git_pass(git_path_is_gitfile("blob", 4, GIT_PATH_GITFILE_GITIGNORE, GIT_PATH_FS_HFS));
+ cl_git_pass(git_path_is_gitfile("blob", 4, GIT_PATH_GITFILE_GITMODULES, GIT_PATH_FS_HFS));
+ cl_git_pass(git_path_is_gitfile("blob", 4, GIT_PATH_GITFILE_GITATTRIBUTES, GIT_PATH_FS_HFS));
+ cl_git_fail(git_path_is_gitfile("blob", 4, 3, GIT_PATH_FS_HFS));
+}
+
+void test_path_dotgit__isvalid_dot_git(void)
+{
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".git", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".git/foo", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "foo/.git", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "foo/.git/bar", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "foo/.GIT/bar", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "foo/bar/.Git", 0, 0));
+
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".git", 0, GIT_PATH_REJECT_DOT_GIT_LITERAL));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".git/foo", 0, GIT_PATH_REJECT_DOT_GIT_LITERAL));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, "foo/.git", 0, GIT_PATH_REJECT_DOT_GIT_LITERAL));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, "foo/.git/bar", 0, GIT_PATH_REJECT_DOT_GIT_LITERAL));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, "foo/.GIT/bar", 0, GIT_PATH_REJECT_DOT_GIT_LITERAL));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, "foo/bar/.Git", 0, GIT_PATH_REJECT_DOT_GIT_LITERAL));
+
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "!git", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "foo/!git", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "!git/bar", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".tig", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "foo/.tig", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".tig/bar", 0, 0));
+}
+
+void test_path_dotgit__isvalid_dotgit_ntfs(void)
+{
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".git", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".git ", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".git.", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".git.. .", 0, 0));
+
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "git~1", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "git~1 ", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "git~1.", 0, 0));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "git~1.. .", 0, 0));
+
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".git", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".git ", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".git.", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".git.. .", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
+
+ cl_assert_equal_b(false, git_path_is_valid(NULL, "git~1", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, "git~1 ", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, "git~1.", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, "git~1.. .", 0, GIT_PATH_REJECT_DOT_GIT_NTFS));
+}
+
+void test_path_dotgit__isvalid_dotgit_with_hfs_ignorables(void)
+{
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".git", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".git\xe2\x80\x8c", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".gi\xe2\x80\x8dT", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".g\xe2\x80\x8eIt", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, ".\xe2\x80\x8fgIt", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, "\xe2\x80\xaa.gIt", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+
+ cl_assert_equal_b(false, git_path_is_valid(NULL, "\xe2\x80\xab.\xe2\x80\xacG\xe2\x80\xadI\xe2\x80\xaet", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, "\xe2\x81\xab.\xe2\x80\xaaG\xe2\x81\xabI\xe2\x80\xact", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(false, git_path_is_valid(NULL, "\xe2\x81\xad.\xe2\x80\xaeG\xef\xbb\xbfIT", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".g", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".gi", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, " .git", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "..git\xe2\x80\x8c", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".gi\xe2\x80\x8dT.", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".g\xe2\x80It", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".\xe2gIt", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, "\xe2\x80\xaa.gi", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".gi\x80\x8dT", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".gi\x8dT", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".g\xe2i\x80T\x8e", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".git\xe2\x80\xbf", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
+ cl_assert_equal_b(true, git_path_is_valid(NULL, ".git\xe2\xab\x81", 0, GIT_PATH_REJECT_DOT_GIT_HFS));
}
diff --git a/tests/refs/branches/create.c b/tests/refs/branches/create.c
index 7a49ad548..2fb11668b 100644
--- a/tests/refs/branches/create.c
+++ b/tests/refs/branches/create.c
@@ -145,7 +145,7 @@ void test_refs_branches_create__can_create_branch_with_unicode(void)
const char *expected[] = { nfc, nfd, emoji };
unsigned int i;
bool fs_decompose_unicode =
- git_path_does_fs_decompose_unicode(git_repository_path(repo));
+ git_fs_path_does_decompose_unicode(git_repository_path(repo));
retrieve_known_commit(&target, repo);
diff --git a/tests/refs/branches/delete.c b/tests/refs/branches/delete.c
index aad5c090f..077882b22 100644
--- a/tests/refs/branches/delete.c
+++ b/tests/refs/branches/delete.c
@@ -173,13 +173,13 @@ void test_refs_branches_delete__removes_empty_folders(void)
cl_git_pass(git_str_joinpath(&ref_folder, commondir, "refs/heads/some/deep"));
cl_git_pass(git_str_join3(&reflog_folder, '/', commondir, GIT_REFLOG_DIR, "refs/heads/some/deep"));
- cl_assert(git_path_exists(git_str_cstr(&ref_folder)) == true);
- cl_assert(git_path_exists(git_str_cstr(&reflog_folder)) == true);
+ cl_assert(git_fs_path_exists(git_str_cstr(&ref_folder)) == true);
+ cl_assert(git_fs_path_exists(git_str_cstr(&reflog_folder)) == true);
cl_git_pass(git_branch_delete(branch));
- cl_assert(git_path_exists(git_str_cstr(&ref_folder)) == false);
- cl_assert(git_path_exists(git_str_cstr(&reflog_folder)) == false);
+ cl_assert(git_fs_path_exists(git_str_cstr(&ref_folder)) == false);
+ cl_assert(git_fs_path_exists(git_str_cstr(&reflog_folder)) == false);
git_reference_free(branch);
git_str_dispose(&ref_folder);
diff --git a/tests/refs/delete.c b/tests/refs/delete.c
index c76d126eb..42cc534b5 100644
--- a/tests/refs/delete.c
+++ b/tests/refs/delete.c
@@ -33,7 +33,7 @@ void test_refs_delete__packed_loose(void)
/* Ensure the loose reference exists on the file system */
cl_git_pass(git_str_joinpath(&temp_path, git_repository_path(g_repo), packed_test_head_name));
- cl_assert(git_path_exists(temp_path.ptr));
+ cl_assert(git_fs_path_exists(temp_path.ptr));
/* Lookup the reference */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
@@ -49,7 +49,7 @@ void test_refs_delete__packed_loose(void)
cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, packed_test_head_name));
/* Ensure the loose reference doesn't exist any longer on the file system */
- cl_assert(!git_path_exists(temp_path.ptr));
+ cl_assert(!git_fs_path_exists(temp_path.ptr));
git_reference_free(another_looked_up_ref);
git_str_dispose(&temp_path);
diff --git a/tests/refs/pack.c b/tests/refs/pack.c
index 125b1adb0..1c1cd51cb 100644
--- a/tests/refs/pack.c
+++ b/tests/refs/pack.c
@@ -63,7 +63,7 @@ void test_refs_pack__loose(void)
/* Ensure the packed-refs file exists */
cl_git_pass(git_str_joinpath(&temp_path, git_repository_path(g_repo), GIT_PACKEDREFS_FILE));
- cl_assert(git_path_exists(temp_path.ptr));
+ cl_assert(git_fs_path_exists(temp_path.ptr));
/* Ensure the known ref can still be looked up but is now packed */
cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
@@ -72,7 +72,7 @@ void test_refs_pack__loose(void)
/* Ensure the known ref has been removed from the loose folder structure */
cl_git_pass(git_str_joinpath(&temp_path, git_repository_path(g_repo), loose_tag_ref_name));
- cl_assert(!git_path_exists(temp_path.ptr));
+ cl_assert(!git_fs_path_exists(temp_path.ptr));
git_reference_free(reference);
git_str_dispose(&temp_path);
diff --git a/tests/refs/ref_helpers.c b/tests/refs/ref_helpers.c
index e55364c6e..943d0f551 100644
--- a/tests/refs/ref_helpers.c
+++ b/tests/refs/ref_helpers.c
@@ -16,7 +16,7 @@ int reference_is_packed(git_reference *ref)
git_reference_name(ref)) < 0)
return -1;
- packed = !git_path_isfile(ref_path.ptr);
+ packed = !git_fs_path_isfile(ref_path.ptr);
git_str_dispose(&ref_path);
diff --git a/tests/refs/reflog/reflog.c b/tests/refs/reflog/reflog.c
index 5bb6138df..32ce7ffb7 100644
--- a/tests/refs/reflog/reflog.c
+++ b/tests/refs/reflog/reflog.c
@@ -107,15 +107,15 @@ void test_refs_reflog_reflog__renaming_the_reference_moves_the_reflog(void)
git_str_joinpath(&master_log_path, git_str_cstr(&master_log_path), "refs/heads/master");
git_str_joinpath(&moved_log_path, git_str_cstr(&moved_log_path), "refs/moved");
- cl_assert_equal_i(true, git_path_isfile(git_str_cstr(&master_log_path)));
- cl_assert_equal_i(false, git_path_isfile(git_str_cstr(&moved_log_path)));
+ cl_assert_equal_i(true, git_fs_path_isfile(git_str_cstr(&master_log_path)));
+ cl_assert_equal_i(false, git_fs_path_isfile(git_str_cstr(&moved_log_path)));
cl_git_pass(git_reference_lookup(&master, g_repo, "refs/heads/master"));
cl_git_pass(git_reference_rename(&new_master, master, "refs/moved", 0, NULL));
git_reference_free(master);
- cl_assert_equal_i(false, git_path_isfile(git_str_cstr(&master_log_path)));
- cl_assert_equal_i(true, git_path_isfile(git_str_cstr(&moved_log_path)));
+ cl_assert_equal_i(false, git_fs_path_isfile(git_str_cstr(&master_log_path)));
+ cl_assert_equal_i(true, git_fs_path_isfile(git_str_cstr(&moved_log_path)));
git_reference_free(new_master);
git_str_dispose(&moved_log_path);
@@ -130,13 +130,13 @@ void test_refs_reflog_reflog__deleting_the_reference_deletes_the_reflog(void)
git_str_joinpath(&master_log_path, git_repository_path(g_repo), GIT_REFLOG_DIR);
git_str_joinpath(&master_log_path, git_str_cstr(&master_log_path), "refs/heads/master");
- cl_assert_equal_i(true, git_path_isfile(git_str_cstr(&master_log_path)));
+ cl_assert_equal_i(true, git_fs_path_isfile(git_str_cstr(&master_log_path)));
cl_git_pass(git_reference_lookup(&master, g_repo, "refs/heads/master"));
cl_git_pass(git_reference_delete(master));
git_reference_free(master);
- cl_assert_equal_i(false, git_path_isfile(git_str_cstr(&master_log_path)));
+ cl_assert_equal_i(false, git_fs_path_isfile(git_str_cstr(&master_log_path)));
git_str_dispose(&master_log_path);
}
@@ -153,7 +153,7 @@ void test_refs_reflog_reflog__removes_empty_reflog_dir(void)
git_str_joinpath(&log_path, git_repository_path(g_repo), GIT_REFLOG_DIR);
git_str_joinpath(&log_path, git_str_cstr(&log_path), "refs/heads/new-dir/new-head");
- cl_assert_equal_i(true, git_path_isfile(git_str_cstr(&log_path)));
+ cl_assert_equal_i(true, git_fs_path_isfile(git_str_cstr(&log_path)));
cl_git_pass(git_reference_delete(ref));
git_reference_free(ref);
@@ -180,7 +180,7 @@ void test_refs_reflog_reflog__fails_gracefully_on_nonempty_reflog_dir(void)
git_str_joinpath(&log_path, git_repository_path(g_repo), GIT_REFLOG_DIR);
git_str_joinpath(&log_path, git_str_cstr(&log_path), "refs/heads/new-dir/new-head");
- cl_assert_equal_i(true, git_path_isfile(git_str_cstr(&log_path)));
+ cl_assert_equal_i(true, git_fs_path_isfile(git_str_cstr(&log_path)));
/* delete the ref manually, leave the reflog */
cl_must_pass(p_unlink("testrepo.git/refs/heads/new-dir/new-head"));
@@ -212,7 +212,7 @@ void test_refs_reflog_reflog__reading_the_reflog_from_a_reference_with_no_log_re
git_str subtrees_log_path = GIT_STR_INIT;
git_str_join_n(&subtrees_log_path, '/', 3, git_repository_path(g_repo), GIT_REFLOG_DIR, refname);
- cl_assert_equal_i(false, git_path_isfile(git_str_cstr(&subtrees_log_path)));
+ cl_assert_equal_i(false, git_fs_path_isfile(git_str_cstr(&subtrees_log_path)));
cl_git_pass(git_reflog_read(&reflog, g_repo, refname));
diff --git a/tests/refs/rename.c b/tests/refs/rename.c
index fa732234a..f71e65782 100644
--- a/tests/refs/rename.c
+++ b/tests/refs/rename.c
@@ -41,7 +41,7 @@ void test_refs_rename__loose(void)
/* Ensure the ref doesn't exist on the file system */
cl_git_pass(git_str_joinpath(&temp_path, git_repository_path(g_repo), new_name));
- cl_assert(!git_path_exists(temp_path.ptr));
+ cl_assert(!git_fs_path_exists(temp_path.ptr));
/* Retrieval of the reference to rename */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, loose_tag_ref_name));
@@ -67,7 +67,7 @@ void test_refs_rename__loose(void)
/* ...and the ref can be found in the file system */
cl_git_pass(git_str_joinpath(&temp_path, git_repository_path(g_repo), new_name));
- cl_assert(git_path_exists(temp_path.ptr));
+ cl_assert(git_fs_path_exists(temp_path.ptr));
git_reference_free(new_ref);
git_reference_free(another_looked_up_ref);
@@ -83,7 +83,7 @@ void test_refs_rename__packed(void)
/* Ensure the ref doesn't exist on the file system */
cl_git_pass(git_str_joinpath(&temp_path, git_repository_path(g_repo), packed_head_name));
- cl_assert(!git_path_exists(temp_path.ptr));
+ cl_assert(!git_fs_path_exists(temp_path.ptr));
/* The reference can however be looked-up... */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
@@ -109,7 +109,7 @@ void test_refs_rename__packed(void)
/* ...and the ref now happily lives in the file system */
cl_git_pass(git_str_joinpath(&temp_path, git_repository_path(g_repo), brand_new_name));
- cl_assert(git_path_exists(temp_path.ptr));
+ cl_assert(git_fs_path_exists(temp_path.ptr));
git_reference_free(new_ref);
git_reference_free(another_looked_up_ref);
@@ -125,7 +125,7 @@ void test_refs_rename__packed_doesnt_pack_others(void)
/* Ensure the other reference exists on the file system */
cl_git_pass(git_str_joinpath(&temp_path, git_repository_path(g_repo), packed_test_head_name));
- cl_assert(git_path_exists(temp_path.ptr));
+ cl_assert(git_fs_path_exists(temp_path.ptr));
/* Lookup the other reference */
cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, packed_test_head_name));
@@ -151,7 +151,7 @@ void test_refs_rename__packed_doesnt_pack_others(void)
cl_assert(reference_is_packed(another_looked_up_ref) == 0);
/* Ensure the other ref still exists on the file system */
- cl_assert(git_path_exists(temp_path.ptr));
+ cl_assert(git_fs_path_exists(temp_path.ptr));
git_reference_free(renamed_ref);
git_reference_free(another_looked_up_ref);
diff --git a/tests/refs/revparse.c b/tests/refs/revparse.c
index 9c960702a..d02249754 100644
--- a/tests/refs/revparse.c
+++ b/tests/refs/revparse.c
@@ -329,13 +329,13 @@ static void create_fake_stash_reference_and_reflog(git_repository *repo)
git_str_joinpath(&log_path, git_repository_path(repo), "logs/refs/fakestash");
- cl_assert_equal_i(false, git_path_isfile(git_str_cstr(&log_path)));
+ cl_assert_equal_i(false, git_fs_path_isfile(git_str_cstr(&log_path)));
cl_git_pass(git_reference_lookup(&master, repo, "refs/heads/master"));
cl_git_pass(git_reference_rename(&new_master, master, "refs/fakestash", 0, NULL));
git_reference_free(master);
- cl_assert_equal_i(true, git_path_isfile(git_str_cstr(&log_path)));
+ cl_assert_equal_i(true, git_fs_path_isfile(git_str_cstr(&log_path)));
git_str_dispose(&log_path);
git_reference_free(new_master);
diff --git a/tests/repo/config.c b/tests/repo/config.c
index 0b9daac98..ee7e43dff 100644
--- a/tests/repo/config.c
+++ b/tests/repo/config.c
@@ -14,7 +14,7 @@ void test_repo_config__initialize(void)
git_str_clear(&path);
cl_must_pass(p_mkdir("alternate", 0777));
- cl_git_pass(git_path_prettify(&path, "alternate", NULL));
+ cl_git_pass(git_fs_path_prettify(&path, "alternate", NULL));
}
void test_repo_config__cleanup(void)
@@ -25,7 +25,7 @@ void test_repo_config__cleanup(void)
cl_git_pass(
git_futils_rmdir_r("alternate", NULL, GIT_RMDIR_REMOVE_FILES));
- cl_assert(!git_path_isdir("alternate"));
+ cl_assert(!git_fs_path_isdir("alternate"));
cl_fixture_cleanup("empty_standard_repo");
@@ -101,7 +101,7 @@ void test_repo_config__read_with_no_configs_at_all(void)
/* with none */
cl_must_pass(p_unlink("empty_standard_repo/.git/config"));
- cl_assert(!git_path_isfile("empty_standard_repo/.git/config"));
+ cl_assert(!git_fs_path_isfile("empty_standard_repo/.git/config"));
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
git_repository__configmap_lookup_cache_clear(repo);
@@ -177,16 +177,16 @@ void test_repo_config__read_with_no_configs_at_all(void)
cl_assert_equal_i(40, val);
cl_must_pass(p_unlink("empty_standard_repo/.git/config"));
- cl_assert(!git_path_isfile("empty_standard_repo/.git/config"));
+ cl_assert(!git_fs_path_isfile("empty_standard_repo/.git/config"));
cl_must_pass(p_unlink("alternate/1/gitconfig"));
- cl_assert(!git_path_isfile("alternate/1/gitconfig"));
+ cl_assert(!git_fs_path_isfile("alternate/1/gitconfig"));
cl_must_pass(p_unlink("alternate/2/config"));
- cl_assert(!git_path_isfile("alternate/2/config"));
+ cl_assert(!git_fs_path_isfile("alternate/2/config"));
cl_must_pass(p_unlink("alternate/3/.gitconfig"));
- cl_assert(!git_path_isfile("alternate/3/.gitconfig"));
+ cl_assert(!git_fs_path_isfile("alternate/3/.gitconfig"));
git_repository__configmap_lookup_cache_clear(repo);
val = -1;
@@ -196,8 +196,8 @@ void test_repo_config__read_with_no_configs_at_all(void)
/* reopen */
- cl_assert(!git_path_isfile("empty_standard_repo/.git/config"));
- cl_assert(!git_path_isfile("alternate/3/.gitconfig"));
+ cl_assert(!git_fs_path_isfile("empty_standard_repo/.git/config"));
+ cl_assert(!git_fs_path_isfile("alternate/3/.gitconfig"));
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
git_repository__configmap_lookup_cache_clear(repo);
@@ -206,6 +206,6 @@ void test_repo_config__read_with_no_configs_at_all(void)
cl_assert_equal_i(7, val);
git_repository_free(repo);
- cl_assert(!git_path_exists("empty_standard_repo/.git/config"));
- cl_assert(!git_path_exists("alternate/3/.gitconfig"));
+ cl_assert(!git_fs_path_exists("empty_standard_repo/.git/config"));
+ cl_assert(!git_fs_path_exists("alternate/3/.gitconfig"));
}
diff --git a/tests/repo/discover.c b/tests/repo/discover.c
index 2a24f1b29..523fdf8e3 100644
--- a/tests/repo/discover.c
+++ b/tests/repo/discover.c
@@ -33,7 +33,7 @@ static void ensure_repository_discover(const char *start_path,
git_str_attach(&resolved, p_realpath(expected_path, NULL), 0);
cl_assert(resolved.size > 0);
- cl_git_pass(git_path_to_dir(&resolved));
+ cl_git_pass(git_fs_path_to_dir(&resolved));
cl_git_pass(git_repository_discover(&found_path, start_path, 1, ceiling_dirs));
cl_assert_equal_s(found_path.ptr, resolved.ptr);
@@ -47,7 +47,7 @@ static void write_file(const char *path, const char *content)
git_file file;
int error;
- if (git_path_exists(path)) {
+ if (git_fs_path_exists(path)) {
cl_git_pass(p_unlink(path));
}
@@ -65,7 +65,7 @@ static void append_ceiling_dir(git_str *ceiling_dirs, const char *path)
git_str pretty_path = GIT_STR_INIT;
char ceiling_separator[2] = { GIT_PATH_LIST_SEPARATOR, '\0' };
- cl_git_pass(git_path_prettify_dir(&pretty_path, path, NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&pretty_path, path, NULL));
if (ceiling_dirs->size > 0)
git_str_puts(ceiling_dirs, ceiling_separator);
diff --git a/tests/repo/env.c b/tests/repo/env.c
index 4bd45d1a6..e3e522480 100644
--- a/tests/repo/env.c
+++ b/tests/repo/env.c
@@ -24,11 +24,11 @@ void test_repo_env__cleanup(void)
{
cl_git_sandbox_cleanup();
- if (git_path_isdir("attr"))
+ if (git_fs_path_isdir("attr"))
git_futils_rmdir_r("attr", NULL, GIT_RMDIR_REMOVE_FILES);
- if (git_path_isdir("testrepo.git"))
+ if (git_fs_path_isdir("testrepo.git"))
git_futils_rmdir_r("testrepo.git", NULL, GIT_RMDIR_REMOVE_FILES);
- if (git_path_isdir("peeled.git"))
+ if (git_fs_path_isdir("peeled.git"))
git_futils_rmdir_r("peeled.git", NULL, GIT_RMDIR_REMOVE_FILES);
clear_git_env();
@@ -81,7 +81,7 @@ static void env_cd_(
const char *file, const char *func, int line)
{
git_str cwd_buf = GIT_STR_INIT;
- cl_git_pass(git_path_prettify_dir(&cwd_buf, ".", NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&cwd_buf, ".", NULL));
cl_must_pass(p_chdir(path));
passfail_(NULL, file, func, line);
cl_must_pass(p_chdir(git_str_cstr(&cwd_buf)));
@@ -141,7 +141,7 @@ void test_repo_env__open(void)
cl_fixture_sandbox("peeled.git");
cl_git_pass(p_rename("attr/.gitted", "attr/.git"));
- cl_git_pass(git_path_prettify_dir(&repo_dir_buf, "attr", NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&repo_dir_buf, "attr", NULL));
repo_dir = git_str_cstr(&repo_dir_buf);
/* GIT_DIR that doesn't exist */
diff --git a/tests/repo/init.c b/tests/repo/init.c
index b41608cca..7cf6742ca 100644
--- a/tests/repo/init.c
+++ b/tests/repo/init.c
@@ -47,7 +47,7 @@ static void ensure_repository_init(
{
const char *workdir;
- cl_assert(!git_path_isdir(working_directory));
+ cl_assert(!git_fs_path_isdir(working_directory));
cl_git_pass(git_repository_init(&g_repo, working_directory, is_bare));
@@ -103,7 +103,7 @@ void test_repo_init__bare_repo_escaping_current_workdir(void)
git_str path_repository = GIT_STR_INIT;
git_str path_current_workdir = GIT_STR_INIT;
- cl_git_pass(git_path_prettify_dir(&path_current_workdir, ".", NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&path_current_workdir, ".", NULL));
cl_git_pass(git_str_joinpath(&path_repository, git_str_cstr(&path_current_workdir), "a/b/c"));
cl_git_pass(git_futils_mkdir_r(git_str_cstr(&path_repository), GIT_DIR_MODE));
@@ -176,15 +176,15 @@ void test_repo_init__additional_templates(void)
cl_git_pass(
git_str_joinpath(&path, git_repository_path(g_repo), "description"));
- cl_assert(git_path_isfile(git_str_cstr(&path)));
+ cl_assert(git_fs_path_isfile(git_str_cstr(&path)));
cl_git_pass(
git_str_joinpath(&path, git_repository_path(g_repo), "info/exclude"));
- cl_assert(git_path_isfile(git_str_cstr(&path)));
+ cl_assert(git_fs_path_isfile(git_str_cstr(&path)));
cl_git_pass(
git_str_joinpath(&path, git_repository_path(g_repo), "hooks"));
- cl_assert(git_path_isdir(git_str_cstr(&path)));
+ cl_assert(git_fs_path_isdir(git_str_cstr(&path)));
/* won't confirm specific contents of hooks dir since it may vary */
git_str_dispose(&path);
@@ -257,7 +257,7 @@ void test_repo_init__symlinks_win32_enabled_by_global_config(void)
git_config *config, *repo_config;
int val;
- if (!git_path_supports_symlinks("link"))
+ if (!git_fs_path_supports_symlinks("link"))
cl_skip();
create_tmp_global_config("tmp_global_config", "core.symlinks", "true");
@@ -303,7 +303,7 @@ void test_repo_init__symlinks_posix_detected(void)
cl_skip();
#else
assert_config_entry_on_init(
- "core.symlinks", git_path_supports_symlinks("link") ? GIT_ENOTFOUND : false);
+ "core.symlinks", git_fs_path_supports_symlinks("link") ? GIT_ENOTFOUND : false);
#endif
}
@@ -418,12 +418,12 @@ void test_repo_init__extended_1(void)
cl_assert(!git__suffixcmp(git_repository_workdir(g_repo), "/c_wd/"));
cl_assert(!git__suffixcmp(git_repository_path(g_repo), "/c.git/"));
- cl_assert(git_path_isfile("root/b/c_wd/.git"));
+ cl_assert(git_fs_path_isfile("root/b/c_wd/.git"));
cl_assert(!git_repository_is_bare(g_repo));
/* repo will not be counted as empty because we set head to "development" */
cl_assert(!git_repository_is_empty(g_repo));
- cl_git_pass(git_path_lstat(git_repository_path(g_repo), &st));
+ cl_git_pass(git_fs_path_lstat(git_repository_path(g_repo), &st));
cl_assert(S_ISDIR(st.st_mode));
if (cl_is_chmod_supported())
cl_assert((S_ISGID & st.st_mode) == S_ISGID);
@@ -482,7 +482,7 @@ void test_repo_init__relative_gitdir_2(void)
git_str dot_git_content = GIT_STR_INIT;
git_str full_path = GIT_STR_INIT;
- cl_git_pass(git_path_prettify(&full_path, ".", NULL));
+ cl_git_pass(git_fs_path_prettify(&full_path, ".", NULL));
cl_git_pass(git_str_joinpath(&full_path, full_path.ptr, "root/b/c_wd"));
opts.workdir_path = full_path.ptr;
@@ -604,16 +604,16 @@ void test_repo_init__at_filesystem_root(void)
if (!cl_is_env_set("GITTEST_INVASIVE_FS_STRUCTURE"))
cl_skip();
- root_len = git_path_root(sandbox);
+ root_len = git_fs_path_root(sandbox);
cl_assert(root_len >= 0);
git_str_put(&root, sandbox, root_len+1);
git_str_joinpath(&root, root.ptr, "libgit2_test_dir");
- cl_assert(!git_path_exists(root.ptr));
+ cl_assert(!git_fs_path_exists(root.ptr));
cl_git_pass(git_repository_init(&repo, root.ptr, 0));
- cl_assert(git_path_isdir(root.ptr));
+ cl_assert(git_fs_path_isdir(root.ptr));
cl_git_pass(git_futils_rmdir_r(root.ptr, NULL, GIT_RMDIR_REMOVE_FILES));
git_str_dispose(&root);
diff --git a/tests/repo/open.c b/tests/repo/open.c
index 6558805c8..f7ed2c373 100644
--- a/tests/repo/open.c
+++ b/tests/repo/open.c
@@ -8,7 +8,7 @@ void test_repo_open__cleanup(void)
{
cl_git_sandbox_cleanup();
- if (git_path_isdir("alternate"))
+ if (git_fs_path_isdir("alternate"))
git_futils_rmdir_r("alternate", NULL, GIT_RMDIR_REMOVE_FILES);
}
@@ -147,7 +147,7 @@ void test_repo_open__with_symlinked_config(void)
cl_git_pass(git_futils_mkdir_r("home", 0777));
cl_git_mkfile("home/.gitconfig.linked", "[global]\ntest = 4567\n");
cl_must_pass(symlink(".gitconfig.linked", "home/.gitconfig"));
- cl_git_pass(git_path_prettify(&path, "home", NULL));
+ cl_git_pass(git_fs_path_prettify(&path, "home", NULL));
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr));
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
@@ -191,7 +191,7 @@ void test_repo_open__from_git_new_workdir(void)
for (scan = links; *scan != NULL; scan++) {
git_str_joinpath(&link_tgt, "empty_standard_repo/.git", *scan);
- if (git_path_exists(link_tgt.ptr)) {
+ if (git_fs_path_exists(link_tgt.ptr)) {
git_str_joinpath(&link_tgt, "../../empty_standard_repo/.git", *scan);
git_str_joinpath(&link, "alternate/.git", *scan);
if (strchr(*scan, '/'))
@@ -201,7 +201,7 @@ void test_repo_open__from_git_new_workdir(void)
}
for (scan = copies; *scan != NULL; scan++) {
git_str_joinpath(&link_tgt, "empty_standard_repo/.git", *scan);
- if (git_path_exists(link_tgt.ptr)) {
+ if (git_fs_path_exists(link_tgt.ptr)) {
git_str_joinpath(&link, "alternate/.git", *scan);
cl_git_pass(git_futils_readbuffer(&body, link_tgt.ptr));
@@ -381,7 +381,7 @@ void test_repo_open__no_config(void)
/* isolate from system level configs */
cl_must_pass(p_mkdir("alternate", 0777));
- cl_git_pass(git_path_prettify(&path, "alternate", NULL));
+ cl_git_pass(git_fs_path_prettify(&path, "alternate", NULL));
cl_git_pass(git_libgit2_opts(
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr));
cl_git_pass(git_libgit2_opts(
diff --git a/tests/repo/setters.c b/tests/repo/setters.c
index 2c33db0db..9a965dec6 100644
--- a/tests/repo/setters.c
+++ b/tests/repo/setters.c
@@ -50,7 +50,7 @@ void test_repo_setters__setting_a_workdir_creates_a_gitlink(void)
cl_git_pass(git_repository_set_workdir(repo, "./new_workdir", true));
- cl_assert(git_path_isfile("./new_workdir/.git"));
+ cl_assert(git_fs_path_isfile("./new_workdir/.git"));
cl_git_pass(git_futils_readbuffer(&content, "./new_workdir/.git"));
cl_assert(git__prefixcmp(git_str_cstr(&content), "gitdir: ") == 0);
diff --git a/tests/repo/template.c b/tests/repo/template.c
index 6f369c6d6..b0af96e36 100644
--- a/tests/repo/template.c
+++ b/tests/repo/template.c
@@ -56,10 +56,10 @@ static void assert_hooks_match(
struct stat expected_st, st;
cl_git_pass(git_str_joinpath(&expected, template_dir, hook_path));
- cl_git_pass(git_path_lstat(expected.ptr, &expected_st));
+ cl_git_pass(git_fs_path_lstat(expected.ptr, &expected_st));
cl_git_pass(git_str_joinpath(&actual, repo_dir, hook_path));
- cl_git_pass(git_path_lstat(actual.ptr, &st));
+ cl_git_pass(git_fs_path_lstat(actual.ptr, &st));
cl_assert(expected_st.st_size == st.st_size);
@@ -88,7 +88,7 @@ static void assert_mode_seems_okay(
struct stat st;
cl_git_pass(git_str_joinpath(&full, base, path));
- cl_git_pass(git_path_lstat(full.ptr, &st));
+ cl_git_pass(git_fs_path_lstat(full.ptr, &st));
git_str_dispose(&full);
if (!core_filemode) {
diff --git a/tests/reset/hard.c b/tests/reset/hard.c
index 36e8f1470..9d177c021 100644
--- a/tests/reset/hard.c
+++ b/tests/reset/hard.c
@@ -79,7 +79,7 @@ void test_reset_hard__resetting_reverts_modified_files(void)
cl_git_pass(git_futils_readbuffer(&content, path.ptr));
cl_assert(strequal_ignore_eol(after[i], content.ptr));
} else {
- cl_assert(!git_path_exists(path.ptr));
+ cl_assert(!git_fs_path_exists(path.ptr));
}
}
@@ -154,7 +154,7 @@ void test_reset_hard__resetting_reverts_unmerged(void)
cl_git_pass(git_revparse_single(&target, repo, "26a125e"));
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL));
- cl_assert(git_path_exists("status/conflicting_file") == 0);
+ cl_assert(git_fs_path_exists("status/conflicting_file") == 0);
git_object_free(target);
target = NULL;
@@ -185,11 +185,11 @@ void test_reset_hard__cleans_up_merge(void)
cl_git_pass(git_revparse_single(&target, repo, "0017bd4"));
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL));
- cl_assert(!git_path_exists(git_str_cstr(&merge_head_path)));
- cl_assert(!git_path_exists(git_str_cstr(&merge_msg_path)));
- cl_assert(!git_path_exists(git_str_cstr(&merge_mode_path)));
+ cl_assert(!git_fs_path_exists(git_str_cstr(&merge_head_path)));
+ cl_assert(!git_fs_path_exists(git_str_cstr(&merge_msg_path)));
+ cl_assert(!git_fs_path_exists(git_str_cstr(&merge_mode_path)));
- cl_assert(git_path_exists(git_str_cstr(&orig_head_path)));
+ cl_assert(git_fs_path_exists(git_str_cstr(&orig_head_path)));
cl_git_pass(p_unlink(git_str_cstr(&orig_head_path)));
git_str_dispose(&merge_head_path);
diff --git a/tests/revert/workdir.c b/tests/revert/workdir.c
index 36824044b..0c9810814 100644
--- a/tests/revert/workdir.c
+++ b/tests/revert/workdir.c
@@ -111,7 +111,7 @@ void test_revert_workdir__conflicts(void)
"File one\n" \
">>>>>>> parent of 72333f4... automergeable changes\n") == 0);
- cl_assert(git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
+ cl_assert(git_fs_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
cl_git_pass(git_futils_readbuffer(&mergemsg_buf,
TEST_REPO_PATH "/.git/MERGE_MSG"));
cl_assert(strcmp(mergemsg_buf.ptr,
@@ -498,8 +498,8 @@ void test_revert_workdir__nonmerge_fails_mainline_specified(void)
opts.mainline = 1;
cl_must_fail(git_revert(repo, commit, &opts));
- cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
- cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/REVERT_HEAD"));
+ cl_assert(!git_fs_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
+ cl_assert(!git_fs_path_exists(TEST_REPO_PATH "/.git/REVERT_HEAD"));
git_reference_free(head);
git_commit_free(commit);
@@ -517,8 +517,8 @@ void test_revert_workdir__merge_fails_without_mainline_specified(void)
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL));
cl_must_fail(git_revert(repo, head, NULL));
- cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
- cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/REVERT_HEAD"));
+ cl_assert(!git_fs_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
+ cl_assert(!git_fs_path_exists(TEST_REPO_PATH "/.git/REVERT_HEAD"));
git_commit_free(head);
}
diff --git a/tests/stash/drop.c b/tests/stash/drop.c
index 6b0895ba8..709ff0f9e 100644
--- a/tests/stash/drop.c
+++ b/tests/stash/drop.c
@@ -37,26 +37,26 @@ static void push_three_states(void)
cl_git_pass(git_repository_index(&index, repo));
cl_git_pass(git_index_add_bypath(index, "zero.txt"));
cl_repo_commit_from_index(NULL, repo, signature, 0, "Initial commit");
- cl_assert(git_path_exists("stash/zero.txt"));
+ cl_assert(git_fs_path_exists("stash/zero.txt"));
git_index_free(index);
cl_git_mkfile("stash/one.txt", "content\n");
cl_git_pass(git_stash_save(
&oid, repo, signature, "First", GIT_STASH_INCLUDE_UNTRACKED));
- cl_assert(!git_path_exists("stash/one.txt"));
- cl_assert(git_path_exists("stash/zero.txt"));
+ cl_assert(!git_fs_path_exists("stash/one.txt"));
+ cl_assert(git_fs_path_exists("stash/zero.txt"));
cl_git_mkfile("stash/two.txt", "content\n");
cl_git_pass(git_stash_save(
&oid, repo, signature, "Second", GIT_STASH_INCLUDE_UNTRACKED));
- cl_assert(!git_path_exists("stash/two.txt"));
- cl_assert(git_path_exists("stash/zero.txt"));
+ cl_assert(!git_fs_path_exists("stash/two.txt"));
+ cl_assert(git_fs_path_exists("stash/zero.txt"));
cl_git_mkfile("stash/three.txt", "content\n");
cl_git_pass(git_stash_save(
&oid, repo, signature, "Third", GIT_STASH_INCLUDE_UNTRACKED));
- cl_assert(!git_path_exists("stash/three.txt"));
- cl_assert(git_path_exists("stash/zero.txt"));
+ cl_assert(!git_fs_path_exists("stash/three.txt"));
+ cl_assert(git_fs_path_exists("stash/zero.txt"));
}
void test_stash_drop__cannot_drop_a_non_existing_stashed_state(void)
diff --git a/tests/stash/save.c b/tests/stash/save.c
index 1fbcf0957..f574211d7 100644
--- a/tests/stash/save.c
+++ b/tests/stash/save.c
@@ -161,16 +161,16 @@ void test_stash_save__untracked_skips_ignored(void)
cl_must_pass(p_mkdir("stash/bundle/vendor", 0777));
cl_git_mkfile("stash/bundle/vendor/blah", "contents\n");
- cl_assert(git_path_exists("stash/when")); /* untracked */
- cl_assert(git_path_exists("stash/just.ignore")); /* ignored */
- cl_assert(git_path_exists("stash/bundle/vendor/blah")); /* ignored */
+ cl_assert(git_fs_path_exists("stash/when")); /* untracked */
+ cl_assert(git_fs_path_exists("stash/just.ignore")); /* ignored */
+ cl_assert(git_fs_path_exists("stash/bundle/vendor/blah")); /* ignored */
cl_git_pass(git_stash_save(
&stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED));
- cl_assert(!git_path_exists("stash/when"));
- cl_assert(git_path_exists("stash/bundle/vendor/blah"));
- cl_assert(git_path_exists("stash/just.ignore"));
+ cl_assert(!git_fs_path_exists("stash/when"));
+ cl_assert(git_fs_path_exists("stash/bundle/vendor/blah"));
+ cl_assert(git_fs_path_exists("stash/just.ignore"));
}
void test_stash_save__can_include_untracked_and_ignored_files(void)
@@ -185,7 +185,7 @@ void test_stash_save__can_include_untracked_and_ignored_files(void)
assert_blob_oid("refs/stash^3:when", "b6ed15e81e2593d7bb6265eb4a991d29dc3e628b");
assert_blob_oid("refs/stash^3:just.ignore", "78925fb1236b98b37a35e9723033e627f97aa88b");
- cl_assert(!git_path_exists("stash/just.ignore"));
+ cl_assert(!git_fs_path_exists("stash/just.ignore"));
}
/*
@@ -450,9 +450,9 @@ void test_stash_save__ignored_directory(void)
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED | GIT_STASH_INCLUDE_IGNORED));
- cl_assert(!git_path_exists("stash/ignored_directory/sub/some_file"));
- cl_assert(!git_path_exists("stash/ignored_directory/sub"));
- cl_assert(!git_path_exists("stash/ignored_directory"));
+ cl_assert(!git_fs_path_exists("stash/ignored_directory/sub/some_file"));
+ cl_assert(!git_fs_path_exists("stash/ignored_directory/sub"));
+ cl_assert(!git_fs_path_exists("stash/ignored_directory"));
}
void test_stash_save__skip_submodules(void)
diff --git a/tests/status/submodules.c b/tests/status/submodules.c
index 38a39471a..d223657b4 100644
--- a/tests/status/submodules.c
+++ b/tests/status/submodules.c
@@ -36,9 +36,9 @@ void test_status_submodules__0(void)
g_repo = setup_fixture_submodules();
- cl_assert(git_path_isdir("submodules/.git"));
- cl_assert(git_path_isdir("submodules/testrepo/.git"));
- cl_assert(git_path_isfile("submodules/.gitmodules"));
+ cl_assert(git_fs_path_isdir("submodules/.git"));
+ cl_assert(git_fs_path_isdir("submodules/testrepo/.git"));
+ cl_assert(git_fs_path_isfile("submodules/.gitmodules"));
cl_git_pass(
git_status_foreach(g_repo, cb_status__count, &counts)
@@ -89,9 +89,9 @@ void test_status_submodules__1(void)
g_repo = setup_fixture_submodules();
- cl_assert(git_path_isdir("submodules/.git"));
- cl_assert(git_path_isdir("submodules/testrepo/.git"));
- cl_assert(git_path_isfile("submodules/.gitmodules"));
+ cl_assert(git_fs_path_isdir("submodules/.git"));
+ cl_assert(git_fs_path_isdir("submodules/testrepo/.git"));
+ cl_assert(git_fs_path_isfile("submodules/.gitmodules"));
status_counts_init(counts, expected_files, expected_status);
diff --git a/tests/status/worktree.c b/tests/status/worktree.c
index 4ab04094a..692ea93ef 100644
--- a/tests/status/worktree.c
+++ b/tests/status/worktree.c
@@ -109,7 +109,7 @@ static int remove_file_cb(void *data, git_str *file)
if (git__suffixcmp(filename, ".git") == 0)
return 0;
- if (git_path_isdir(filename))
+ if (git_fs_path_isdir(filename))
cl_git_pass(git_futils_rmdir_r(filename, NULL, GIT_RMDIR_REMOVE_FILES));
else
cl_git_pass(p_unlink(git_str_cstr(file)));
@@ -126,7 +126,7 @@ void test_status_worktree__purged_worktree(void)
/* first purge the contents of the worktree */
cl_git_pass(git_str_sets(&workdir, git_repository_workdir(repo)));
- cl_git_pass(git_path_direach(&workdir, 0, remove_file_cb, NULL));
+ cl_git_pass(git_fs_path_direach(&workdir, 0, remove_file_cb, NULL));
git_str_dispose(&workdir);
/* now get status */
@@ -374,7 +374,7 @@ void test_status_worktree__issue_592(void)
repo = cl_git_sandbox_init("issue_592");
cl_git_pass(git_str_joinpath(&path, git_repository_workdir(repo), "l.txt"));
cl_git_pass(p_unlink(git_str_cstr(&path)));
- cl_assert(!git_path_exists("issue_592/l.txt"));
+ cl_assert(!git_fs_path_exists("issue_592/l.txt"));
cl_git_pass(git_status_foreach(repo, cb_status__check_592, "l.txt"));
@@ -389,7 +389,7 @@ void test_status_worktree__issue_592_2(void)
repo = cl_git_sandbox_init("issue_592");
cl_git_pass(git_str_joinpath(&path, git_repository_workdir(repo), "c/a.txt"));
cl_git_pass(p_unlink(git_str_cstr(&path)));
- cl_assert(!git_path_exists("issue_592/c/a.txt"));
+ cl_assert(!git_fs_path_exists("issue_592/c/a.txt"));
cl_git_pass(git_status_foreach(repo, cb_status__check_592, "c/a.txt"));
@@ -405,7 +405,7 @@ void test_status_worktree__issue_592_3(void)
cl_git_pass(git_str_joinpath(&path, git_repository_workdir(repo), "c"));
cl_git_pass(git_futils_rmdir_r(git_str_cstr(&path), NULL, GIT_RMDIR_REMOVE_FILES));
- cl_assert(!git_path_exists("issue_592/c/a.txt"));
+ cl_assert(!git_fs_path_exists("issue_592/c/a.txt"));
cl_git_pass(git_status_foreach(repo, cb_status__check_592, "c/a.txt"));
diff --git a/tests/submodule/add.c b/tests/submodule/add.c
index b564123dd..ae5507d7f 100644
--- a/tests/submodule/add.c
+++ b/tests/submodule/add.c
@@ -46,11 +46,11 @@ void test_submodule_add__url_absolute(void)
);
git_submodule_free(sm);
- cl_assert(git_path_isfile("submod2/" "sm_libgit2" "/.git"));
+ cl_assert(git_fs_path_isfile("submod2/" "sm_libgit2" "/.git"));
- cl_assert(git_path_isdir("submod2/.git/modules"));
- cl_assert(git_path_isdir("submod2/.git/modules/" "sm_libgit2"));
- cl_assert(git_path_isfile("submod2/.git/modules/" "sm_libgit2" "/HEAD"));
+ cl_assert(git_fs_path_isdir("submod2/.git/modules"));
+ cl_assert(git_fs_path_isdir("submod2/.git/modules/" "sm_libgit2"));
+ cl_assert(git_fs_path_isfile("submod2/.git/modules/" "sm_libgit2" "/HEAD"));
assert_submodule_url("sm_libgit2", "https://github.com/libgit2/libgit2.git");
cl_git_pass(git_repository_open(&repo, "submod2/" "sm_libgit2"));
@@ -72,9 +72,9 @@ void test_submodule_add__url_absolute(void)
);
git_submodule_free(sm);
- cl_assert(git_path_isdir("submod2/" "sm_libgit2b" "/.git"));
- cl_assert(git_path_isfile("submod2/" "sm_libgit2b" "/.git/HEAD"));
- cl_assert(!git_path_exists("submod2/.git/modules/" "sm_libgit2b"));
+ cl_assert(git_fs_path_isdir("submod2/" "sm_libgit2b" "/.git"));
+ cl_assert(git_fs_path_isfile("submod2/" "sm_libgit2b" "/.git/HEAD"));
+ cl_assert(!git_fs_path_exists("submod2/.git/modules/" "sm_libgit2b"));
assert_submodule_url("sm_libgit2b", "https://github.com/libgit2/libgit2.git");
}
@@ -227,7 +227,7 @@ void test_submodule_add__submodule_clone_into_nonempty_dir_succeeds(void)
cl_git_pass(git_submodule_clone(NULL, sm, NULL));
cl_git_pass(git_submodule_add_finalize(sm));
- cl_assert(git_path_exists("empty_standard_repo/sm/foobar"));
+ cl_assert(git_fs_path_exists("empty_standard_repo/sm/foobar"));
assert_submodule_exists(g_repo, "sm");
diff --git a/tests/submodule/init.c b/tests/submodule/init.c
index bf865a9e8..a8e1291c4 100644
--- a/tests/submodule/init.c
+++ b/tests/submodule/init.c
@@ -20,7 +20,7 @@ void test_submodule_init__absolute_url(void)
g_repo = setup_fixture_submodule_simple();
- cl_assert(git_path_dirname_r(&absolute_url, git_repository_workdir(g_repo)) > 0);
+ cl_assert(git_fs_path_dirname_r(&absolute_url, git_repository_workdir(g_repo)) > 0);
cl_git_pass(git_str_joinpath(&absolute_url, absolute_url.ptr, "testrepo.git"));
/* write the absolute url to the .gitmodules file*/
@@ -53,7 +53,7 @@ void test_submodule_init__relative_url(void)
g_repo = setup_fixture_submodule_simple();
- cl_assert(git_path_dirname_r(&absolute_url, git_repository_workdir(g_repo)) > 0);
+ cl_assert(git_fs_path_dirname_r(&absolute_url, git_repository_workdir(g_repo)) > 0);
cl_git_pass(git_str_joinpath(&absolute_url, absolute_url.ptr, "testrepo.git"));
cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
@@ -91,7 +91,7 @@ void test_submodule_init__relative_url_detached_head(void)
cl_git_pass(git_repository_set_head_detached(g_repo, git_commit_id((git_commit *)head_commit)));
- cl_assert(git_path_dirname_r(&absolute_url, git_repository_workdir(g_repo)) > 0);
+ cl_assert(git_fs_path_dirname_r(&absolute_url, git_repository_workdir(g_repo)) > 0);
cl_git_pass(git_str_joinpath(&absolute_url, absolute_url.ptr, "testrepo.git"));
cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
diff --git a/tests/submodule/open.c b/tests/submodule/open.c
index 4f31feedf..e6883d208 100644
--- a/tests/submodule/open.c
+++ b/tests/submodule/open.c
@@ -27,9 +27,9 @@ static void assert_sm_valid(git_repository *parent, git_repository *child, const
/* assert working directory */
cl_git_pass(git_str_joinpath(&expected, git_repository_workdir(parent), sm_name));
- cl_git_pass(git_path_prettify_dir(&expected, expected.ptr, NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&expected, expected.ptr, NULL));
cl_git_pass(git_str_sets(&actual, git_repository_workdir(child)));
- cl_git_pass(git_path_prettify_dir(&actual, actual.ptr, NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&actual, actual.ptr, NULL));
cl_assert_equal_s(expected.ptr, actual.ptr);
git_str_clear(&expected);
@@ -38,14 +38,14 @@ static void assert_sm_valid(git_repository *parent, git_repository *child, const
/* assert common directory */
cl_git_pass(git_str_joinpath(&expected, git_repository_commondir(parent), "modules"));
cl_git_pass(git_str_joinpath(&expected, expected.ptr, sm_name));
- cl_git_pass(git_path_prettify_dir(&expected, expected.ptr, NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&expected, expected.ptr, NULL));
cl_git_pass(git_str_sets(&actual, git_repository_commondir(child)));
- cl_git_pass(git_path_prettify_dir(&actual, actual.ptr, NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&actual, actual.ptr, NULL));
cl_assert_equal_s(expected.ptr, actual.ptr);
/* assert git directory */
cl_git_pass(git_str_sets(&actual, git_repository_path(child)));
- cl_git_pass(git_path_prettify_dir(&actual, actual.ptr, NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&actual, actual.ptr, NULL));
cl_assert_equal_s(expected.ptr, actual.ptr);
git_str_dispose(&expected);
diff --git a/tests/submodule/repository_init.c b/tests/submodule/repository_init.c
index 3927afc2e..39b55c403 100644
--- a/tests/submodule/repository_init.c
+++ b/tests/submodule/repository_init.c
@@ -26,11 +26,11 @@ void test_submodule_repository_init__basic(void)
cl_git_pass(git_futils_readbuffer(&dot_git_content, "submod2/" "sm_gitmodules_only" "/.git"));
cl_assert_equal_s("gitdir: ../.git/modules/sm_gitmodules_only/", dot_git_content.ptr);
- cl_assert(git_path_isfile("submod2/" "sm_gitmodules_only" "/.git"));
+ cl_assert(git_fs_path_isfile("submod2/" "sm_gitmodules_only" "/.git"));
- cl_assert(git_path_isdir("submod2/.git/modules"));
- cl_assert(git_path_isdir("submod2/.git/modules/" "sm_gitmodules_only"));
- cl_assert(git_path_isfile("submod2/.git/modules/" "sm_gitmodules_only" "/HEAD"));
+ cl_assert(git_fs_path_isdir("submod2/.git/modules"));
+ cl_assert(git_fs_path_isdir("submod2/.git/modules/" "sm_gitmodules_only"));
+ cl_assert(git_fs_path_isfile("submod2/.git/modules/" "sm_gitmodules_only" "/HEAD"));
git_submodule_free(sm);
git_repository_free(repo);
diff --git a/tests/submodule/submodule_helpers.c b/tests/submodule/submodule_helpers.c
index 95d20a009..b8fc9f60d 100644
--- a/tests/submodule/submodule_helpers.c
+++ b/tests/submodule/submodule_helpers.c
@@ -65,7 +65,7 @@ void rewrite_gitmodules(const char *workdir)
continue;
}
- git_path_prettify(&path, path.ptr, NULL);
+ git_fs_path_prettify(&path, path.ptr, NULL);
git_str_putc(&path, '\n');
cl_assert(!git_str_oom(&path));
diff --git a/tests/worktree/merge.c b/tests/worktree/merge.c
index 8bb95d1f7..5b7e2a837 100644
--- a/tests/worktree/merge.c
+++ b/tests/worktree/merge.c
@@ -73,7 +73,7 @@ void test_worktree_merge__merge_setup(void)
cl_git_pass(git_str_joinpath(&path,
fixture.worktree->gitdir,
merge_files[i]));
- cl_assert(git_path_exists(path.ptr));
+ cl_assert(git_fs_path_exists(path.ptr));
}
git_str_dispose(&path);
diff --git a/tests/worktree/refs.c b/tests/worktree/refs.c
index 5ae17ca19..557726aaf 100644
--- a/tests/worktree/refs.c
+++ b/tests/worktree/refs.c
@@ -181,14 +181,14 @@ void test_worktree_refs__creating_refs_uses_commondir(void)
cl_git_pass(git_str_joinpath(&refpath,
git_repository_commondir(fixture.worktree), "refs/heads/testbranch"));
- cl_assert(!git_path_exists(refpath.ptr));
+ cl_assert(!git_fs_path_exists(refpath.ptr));
cl_git_pass(git_repository_head(&head, fixture.worktree));
cl_git_pass(git_commit_lookup(&commit, fixture.worktree, git_reference_target(head)));
cl_git_pass(git_branch_create(&branch, fixture.worktree, "testbranch", commit, 0));
cl_git_pass(git_branch_lookup(&lookup, fixture.worktree, "testbranch", GIT_BRANCH_LOCAL));
cl_assert(git_reference_cmp(branch, lookup) == 0);
- cl_assert(git_path_exists(refpath.ptr));
+ cl_assert(git_fs_path_exists(refpath.ptr));
git_reference_free(lookup);
git_reference_free(branch);
diff --git a/tests/worktree/submodule.c b/tests/worktree/submodule.c
index 4c6c657d3..6b0c07452 100644
--- a/tests/worktree/submodule.c
+++ b/tests/worktree/submodule.c
@@ -67,7 +67,7 @@ void test_worktree_submodule__resolve_relative_url(void)
git_worktree *wt;
cl_git_pass(git_futils_mkdir("subdir", 0755, GIT_MKDIR_PATH));
- cl_git_pass(git_path_prettify_dir(&wt_path, "subdir", NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&wt_path, "subdir", NULL));
cl_git_pass(git_str_joinpath(&wt_path, wt_path.ptr, "wt"));
/* Open child repository, which is a submodule */
diff --git a/tests/worktree/worktree.c b/tests/worktree/worktree.c
index a9a50fbf1..6f14b17f1 100644
--- a/tests/worktree/worktree.c
+++ b/tests/worktree/worktree.c
@@ -330,7 +330,7 @@ void test_worktree_worktree__init_existing_path(void)
for (i = 0; i < ARRAY_SIZE(wtfiles); i++) {
cl_git_pass(git_str_joinpath(&path,
fixture.worktree->gitdir, wtfiles[i]));
- cl_assert(!git_path_exists(path.ptr));
+ cl_assert(!git_fs_path_exists(path.ptr));
}
git_str_dispose(&path);
@@ -351,9 +351,9 @@ void test_worktree_worktree__init_submodule(void)
cl_git_pass(git_worktree_add(&worktree, sm, "repo-worktree", path.ptr, NULL));
cl_git_pass(git_repository_open_from_worktree(&wt, worktree));
- cl_git_pass(git_path_prettify_dir(&path, path.ptr, NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&path, path.ptr, NULL));
cl_assert_equal_s(path.ptr, wt->workdir);
- cl_git_pass(git_path_prettify_dir(&path, sm->commondir, NULL));
+ cl_git_pass(git_fs_path_prettify_dir(&path, sm->commondir, NULL));
cl_assert_equal_s(sm->commondir, wt->commondir);
cl_git_pass(git_str_joinpath(&path, sm->gitdir, "worktrees/repo-worktree/"));
@@ -560,8 +560,8 @@ void test_worktree_worktree__prune_gitdir_only(void)
cl_git_pass(git_worktree_lookup(&wt, fixture.repo, "testrepo-worktree"));
cl_git_pass(git_worktree_prune(wt, &opts));
- cl_assert(!git_path_exists(wt->gitdir_path));
- cl_assert(git_path_exists(wt->gitlink_path));
+ cl_assert(!git_fs_path_exists(wt->gitdir_path));
+ cl_assert(git_fs_path_exists(wt->gitlink_path));
git_worktree_free(wt);
}
@@ -576,8 +576,8 @@ void test_worktree_worktree__prune_worktree(void)
cl_git_pass(git_worktree_lookup(&wt, fixture.repo, "testrepo-worktree"));
cl_git_pass(git_worktree_prune(wt, &opts));
- cl_assert(!git_path_exists(wt->gitdir_path));
- cl_assert(!git_path_exists(wt->gitlink_path));
+ cl_assert(!git_fs_path_exists(wt->gitdir_path));
+ cl_assert(!git_fs_path_exists(wt->gitlink_path));
git_worktree_free(wt);
}