diff options
| author | Russell Belfer <arrbee@arrbee.com> | 2012-01-17 15:49:47 -0800 |
|---|---|---|
| committer | Russell Belfer <arrbee@arrbee.com> | 2012-01-17 15:49:47 -0800 |
| commit | 1744fafec05d8fa3036a43f5e390c790810b05a5 (patch) | |
| tree | b87f0616dd832ec66cc2450b5751b70d468a350e /tests | |
| parent | d1317f1b69cafb328ca9b263b2b71cddeb2290be (diff) | |
| download | libgit2-1744fafec05d8fa3036a43f5e390c790810b05a5.tar.gz | |
Move path related functions from fileops to path
This takes all of the functions that look up simple data about
paths (such as `git_futils_isdir`) and moves them over to path.h
(becoming `git_path_isdir`). This leaves fileops.h just with
functions that actually manipulate the filesystem or look at
the file contents in some way.
As part of this, the dir.h header which is really just for win32
support was moved into win32 (with some minor changes).
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/t00-core.c | 14 | ||||
| -rw-r--r-- | tests/t03-objwrite.c | 4 | ||||
| -rw-r--r-- | tests/t10-refs.c | 20 | ||||
| -rw-r--r-- | tests/t12-repo.c | 2 | ||||
| -rw-r--r-- | tests/test_helpers.c | 14 |
5 files changed, 27 insertions, 27 deletions
diff --git a/tests/t00-core.c b/tests/t00-core.c index 708a889de..58f048af6 100644 --- a/tests/t00-core.c +++ b/tests/t00-core.c @@ -362,7 +362,7 @@ static walk_data dot = { BEGIN_TEST(dirent0, "make sure that the '.' folder is not traversed") must_pass(setup(&dot)); - must_pass(git_futils_direach(&dot.path, + must_pass(git_path_direach(&dot.path, one_entry, &dot)); @@ -387,7 +387,7 @@ BEGIN_TEST(dirent1, "traverse a subfolder") must_pass(setup(&sub)); - must_pass(git_futils_direach(&sub.path, + must_pass(git_path_direach(&sub.path, one_entry, &sub)); @@ -406,7 +406,7 @@ BEGIN_TEST(dirent2, "traverse a slash-terminated subfolder") must_pass(setup(&sub_slash)); - must_pass(git_futils_direach(&sub_slash.path, + must_pass(git_path_direach(&sub_slash.path, one_entry, &sub_slash)); @@ -435,14 +435,14 @@ BEGIN_TEST(dirent3, "make sure that empty folders are not traversed") must_pass(setup(&empty)); - must_pass(git_futils_direach(&empty.path, + must_pass(git_path_direach(&empty.path, one_entry, &empty)); must_pass(check_counts(&empty)); /* make sure callback not called */ - must_pass(git_futils_direach(&empty.path, + must_pass(git_path_direach(&empty.path, dont_call_me, &empty)); @@ -467,7 +467,7 @@ BEGIN_TEST(dirent4, "make sure that strange looking filenames ('..c') are traver must_pass(setup(&odd)); - must_pass(git_futils_direach(&odd.path, + must_pass(git_path_direach(&odd.path, one_entry, &odd)); @@ -485,7 +485,7 @@ BEGIN_TEST(filebuf0, "make sure git_filebuf_open doesn't delete an existing lock must_pass(fd); must_pass(p_close(fd)); must_fail(git_filebuf_open(&file, test, 0)); - must_pass(git_futils_exists(testlock)); + must_pass(git_path_exists(testlock)); must_pass(p_unlink(testlock)); END_TEST diff --git a/tests/t03-objwrite.c b/tests/t03-objwrite.c index 1fc0cac5e..1650b8060 100644 --- a/tests/t03-objwrite.c +++ b/tests/t03-objwrite.c @@ -44,9 +44,9 @@ static int make_odb_dir(void) static int check_object_files(object_data *d) { - if (git_futils_exists(d->dir) < 0) + if (git_path_exists(d->dir) < 0) return -1; - if (git_futils_exists(d->file) < 0) + if (git_path_exists(d->file) < 0) return -1; return 0; } diff --git a/tests/t10-refs.c b/tests/t10-refs.c index e8c7b7e00..63d1cb7d1 100644 --- a/tests/t10-refs.c +++ b/tests/t10-refs.c @@ -530,7 +530,7 @@ BEGIN_TEST(pack1, "create a packfile from all the loose rn a repo") /* Ensure the packed-refs file exists */ must_pass(git_buf_joinpath(&temp_path, repo->path_repository, GIT_PACKEDREFS_FILE)); - must_pass(git_futils_exists(temp_path.ptr)); + must_pass(git_path_exists(temp_path.ptr)); /* Ensure the known ref can still be looked up but is now packed */ must_pass(git_reference_lookup(&reference, repo, loose_tag_ref_name)); @@ -539,7 +539,7 @@ BEGIN_TEST(pack1, "create a packfile from all the loose rn a repo") /* Ensure the known ref has been removed from the loose folder structure */ must_pass(git_buf_joinpath(&temp_path, repo->path_repository, loose_tag_ref_name)); - must_pass(!git_futils_exists(temp_path.ptr)); + must_pass(!git_path_exists(temp_path.ptr)); close_temp_repo(repo); @@ -557,7 +557,7 @@ BEGIN_TEST(rename0, "rename a loose reference") /* Ensure the ref doesn't exist on the file system */ must_pass(git_buf_joinpath(&temp_path, repo->path_repository, new_name)); - must_pass(!git_futils_exists(temp_path.ptr)); + must_pass(!git_path_exists(temp_path.ptr)); /* Retrieval of the reference to rename */ must_pass(git_reference_lookup(&looked_up_ref, repo, loose_tag_ref_name)); @@ -582,7 +582,7 @@ BEGIN_TEST(rename0, "rename a loose reference") /* ...and the ref can be found in the file system */ must_pass(git_buf_joinpath(&temp_path, repo->path_repository, new_name)); - must_pass(git_futils_exists(temp_path.ptr)); + must_pass(git_path_exists(temp_path.ptr)); close_temp_repo(repo); @@ -601,7 +601,7 @@ BEGIN_TEST(rename1, "rename a packed reference (should make it loose)") /* Ensure the ref doesn't exist on the file system */ must_pass(git_buf_joinpath(&temp_path, repo->path_repository, packed_head_name)); - must_pass(!git_futils_exists(temp_path.ptr)); + must_pass(!git_path_exists(temp_path.ptr)); /* The reference can however be looked-up... */ must_pass(git_reference_lookup(&looked_up_ref, repo, packed_head_name)); @@ -626,7 +626,7 @@ BEGIN_TEST(rename1, "rename a packed reference (should make it loose)") /* ...and the ref now happily lives in the file system */ must_pass(git_buf_joinpath(&temp_path, repo->path_repository, brand_new_name)); - must_pass(git_futils_exists(temp_path.ptr)); + must_pass(git_path_exists(temp_path.ptr)); close_temp_repo(repo); @@ -645,7 +645,7 @@ BEGIN_TEST(rename2, "renaming a packed reference does not pack another reference /* Ensure the other reference exists on the file system */ must_pass(git_buf_joinpath(&temp_path, repo->path_repository, packed_test_head_name)); - must_pass(git_futils_exists(temp_path.ptr)); + must_pass(git_path_exists(temp_path.ptr)); /* Lookup the other reference */ must_pass(git_reference_lookup(&another_looked_up_ref, repo, packed_test_head_name)); @@ -670,7 +670,7 @@ BEGIN_TEST(rename2, "renaming a packed reference does not pack another reference must_be_true(git_reference_is_packed(another_looked_up_ref) == 0); /* Ensure the other ref still exists on the file system */ - must_pass(git_futils_exists(temp_path.ptr)); + must_pass(git_path_exists(temp_path.ptr)); close_temp_repo(repo); @@ -899,7 +899,7 @@ BEGIN_TEST(delete0, "deleting a ref which is both packed and loose should remove /* Ensure the loose reference exists on the file system */ must_pass(git_buf_joinpath(&temp_path, repo->path_repository, packed_test_head_name)); - must_pass(git_futils_exists(temp_path.ptr)); + must_pass(git_path_exists(temp_path.ptr)); /* Lookup the reference */ must_pass(git_reference_lookup(&looked_up_ref, repo, packed_test_head_name)); @@ -914,7 +914,7 @@ BEGIN_TEST(delete0, "deleting a ref which is both packed and loose should remove must_fail(git_reference_lookup(&another_looked_up_ref, repo, packed_test_head_name)); /* Ensure the loose reference doesn't exist any longer on the file system */ - must_pass(!git_futils_exists(temp_path.ptr)); + must_pass(!git_path_exists(temp_path.ptr)); close_temp_repo(repo); diff --git a/tests/t12-repo.c b/tests/t12-repo.c index 0b245656c..6a080ecb3 100644 --- a/tests/t12-repo.c +++ b/tests/t12-repo.c @@ -68,7 +68,7 @@ static int write_file(const char *path, const char *content) int error; git_file file; - if (git_futils_exists(path) == GIT_SUCCESS) { + if (git_path_exists(path) == GIT_SUCCESS) { error = p_unlink(path); if (error < GIT_SUCCESS) diff --git a/tests/test_helpers.c b/tests/test_helpers.c index 40b3499bb..42c8031cd 100644 --- a/tests/test_helpers.c +++ b/tests/test_helpers.c @@ -238,8 +238,8 @@ static int copy_filesystem_element_recurs(void *_data, git_buf *source) git_buf_truncate(&data->dst, data->dst_baselen); git_buf_puts(&data->dst, source->ptr + data->src_baselen); - if (git_futils_isdir(source->ptr) == GIT_SUCCESS) - return git_futils_direach(source, copy_filesystem_element_recurs, _data); + if (git_path_isdir(source->ptr) == GIT_SUCCESS) + return git_path_direach(source, copy_filesystem_element_recurs, _data); else return copy_file(source->ptr, data->dst.ptr); } @@ -252,8 +252,8 @@ int copydir_recurs( copydir_data data = { GIT_BUF_INIT, 0, GIT_BUF_INIT, 0 }; /* Source has to exist, Destination hast to _not_ exist */ - if (git_futils_isdir(source_directory_path) != GIT_SUCCESS || - git_futils_isdir(destination_directory_path) == GIT_SUCCESS) + if (git_path_isdir(source_directory_path) != GIT_SUCCESS || + git_path_isdir(destination_directory_path) == GIT_SUCCESS) return GIT_EINVALIDPATH; git_buf_joinpath(&data.src, source_directory_path, ""); @@ -298,8 +298,8 @@ static int remove_placeholders_recurs(void *_data, git_buf *path) remove_data *data = (remove_data *)_data; size_t pathlen; - if (!git_futils_isdir(path->ptr)) - return git_futils_direach(path, remove_placeholders_recurs, data); + if (!git_path_isdir(path->ptr)) + return git_path_direach(path, remove_placeholders_recurs, data); pathlen = path->size; @@ -321,7 +321,7 @@ int remove_placeholders(const char *directory_path, const char *filename) remove_data data; git_buf buffer = GIT_BUF_INIT; - if (git_futils_isdir(directory_path)) + if (git_path_isdir(directory_path)) return GIT_EINVALIDPATH; if ((error = git_buf_sets(&buffer, directory_path)) < GIT_SUCCESS) |
