diff options
Diffstat (limited to 'tests-clar')
| -rw-r--r-- | tests-clar/clar_libgit2.c | 2 | ||||
| -rw-r--r-- | tests-clar/clone/nonetwork.c | 29 | ||||
| -rw-r--r-- | tests-clar/core/dirent.c | 24 | ||||
| -rw-r--r-- | tests-clar/merge/merge_helpers.c | 2 | ||||
| -rw-r--r-- | tests-clar/status/worktree.c | 2 |
5 files changed, 20 insertions, 39 deletions
diff --git a/tests-clar/clar_libgit2.c b/tests-clar/clar_libgit2.c index 6063bf91c..0f8f26efb 100644 --- a/tests-clar/clar_libgit2.c +++ b/tests-clar/clar_libgit2.c @@ -301,7 +301,7 @@ static int remove_placeholders_recurs(void *_data, git_buf *path) size_t pathlen; if (git_path_isdir(path->ptr) == true) - return git_path_direach(path, remove_placeholders_recurs, data); + return git_path_direach(path, 0, remove_placeholders_recurs, data); pathlen = path->size; diff --git a/tests-clar/clone/nonetwork.c b/tests-clar/clone/nonetwork.c index 4bcb5be1e..c4d75a8dc 100644 --- a/tests-clar/clone/nonetwork.c +++ b/tests-clar/clone/nonetwork.c @@ -63,34 +63,27 @@ static int dont_call_me(void *state, git_buf *path) return GIT_ERROR; } -void test_clone_nonetwork__do_not_clean_existing_directory(void) +static void assert_empty_directory(const char *path) { - git_buf path_buf = GIT_BUF_INIT; - - git_buf_put(&path_buf, "./foo", 5); + git_buf buf = GIT_BUF_INIT; + cl_assert(git_path_exists(path)); + cl_git_pass(git_buf_sets(&buf, path)); + cl_git_pass(git_path_direach(&buf, 0, dont_call_me, NULL)); + git_buf_free(&buf); +} +void test_clone_nonetwork__do_not_clean_existing_directory(void) +{ /* Clone should not remove the directory if it already exists, but * 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_exists("./foo")); - - /* Make sure the directory is empty. */ - cl_git_pass(git_path_direach(&path_buf, - dont_call_me, - NULL)); + assert_empty_directory("./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_exists("./foo")); - - /* Make sure the directory is empty. */ - cl_git_pass(git_path_direach(&path_buf, - dont_call_me, - NULL)); - - git_buf_free(&path_buf); + assert_empty_directory("./foo"); } void test_clone_nonetwork__local(void) diff --git a/tests-clar/core/dirent.c b/tests-clar/core/dirent.c index 5a7859d1b..a9a83e827 100644 --- a/tests-clar/core/dirent.c +++ b/tests-clar/core/dirent.c @@ -115,9 +115,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, - one_entry, - &dot)); + cl_git_pass(git_path_direach(&dot.path, 0, one_entry, &dot)); check_counts(&dot); } @@ -141,9 +139,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, - one_entry, - &sub)); + cl_git_pass(git_path_direach(&sub.path, 0, one_entry, &sub)); check_counts(&sub); } @@ -161,9 +157,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, - one_entry, - &sub_slash)); + cl_git_pass(git_path_direach(&sub_slash.path, 0, one_entry, &sub_slash)); check_counts(&sub_slash); } @@ -184,16 +178,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, - one_entry, - &empty)); + cl_git_pass(git_path_direach(&empty.path, 0, one_entry, &empty)); check_counts(&empty); /* make sure callback not called */ - cl_git_pass(git_path_direach(&empty.path, - dont_call_me, - &empty)); + cl_git_pass(git_path_direach(&empty.path, 0, dont_call_me, &empty)); } static name_data odd_names[] = { @@ -216,9 +206,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, - one_entry, - &odd)); + cl_git_pass(git_path_direach(&odd.path, 0, one_entry, &odd)); check_counts(&odd); } diff --git a/tests-clar/merge/merge_helpers.c b/tests-clar/merge/merge_helpers.c index e4092787c..ddcb93ff6 100644 --- a/tests-clar/merge/merge_helpers.c +++ b/tests-clar/merge/merge_helpers.c @@ -291,7 +291,7 @@ int merge_test_workdir(git_repository *repo, const struct merge_index_entry expe git_buf wd = GIT_BUF_INIT; git_buf_puts(&wd, repo->workdir); - git_path_direach(&wd, dircount, &actual_len); + git_path_direach(&wd, 0, dircount, &actual_len); if (actual_len != expected_len) return 0; diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c index 135a95871..3b569c7ba 100644 --- a/tests-clar/status/worktree.c +++ b/tests-clar/status/worktree.c @@ -119,7 +119,7 @@ void test_status_worktree__purged_worktree(void) /* first purge the contents of the worktree */ cl_git_pass(git_buf_sets(&workdir, git_repository_workdir(repo))); - cl_git_pass(git_path_direach(&workdir, remove_file_cb, NULL)); + cl_git_pass(git_path_direach(&workdir, 0, remove_file_cb, NULL)); git_buf_free(&workdir); /* now get status */ |
