summaryrefslogtreecommitdiff
path: root/tests-clar/clone/nonetwork.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-10-01 16:12:15 -0700
committerRussell Belfer <rb@github.com>2013-10-03 10:44:13 -0700
commit219d3457324e8c2652e3462cedaf648912b40281 (patch)
tree4dcd3bd4aa22d5a9827fbc87c52546ce2a2cd7a1 /tests-clar/clone/nonetwork.c
parent2fe54afa2a8f87d03d2d550dcde7718f27e40967 (diff)
downloadlibgit2-219d3457324e8c2652e3462cedaf648912b40281.tar.gz
Initial iconv hookup for precomposed unicode
This hooks up git_path_direach and git_path_dirload so that they will take a flag indicating if directory entry names should be tested and converted from decomposed unicode to precomposed form. This code will only come into play on the Apple platform and even then, only when certain types of filesystems are used. This involved adding a flag to these functions which involved changing a lot of places in the code. This was an opportunity to do a bit of code cleanup here and there, for example, getting rid of the git_futils_cleanupdir_r function in favor of a simple flag to git_futils_rmdir_r to not remove the top level entry. That ended up adding depth tracking during rmdir_r which led to a safety check for infinite directory recursion. Yay. This hasn't actually been tested on the Mac filesystems where the issue occurs. I still need to get test environment for that.
Diffstat (limited to 'tests-clar/clone/nonetwork.c')
-rw-r--r--tests-clar/clone/nonetwork.c29
1 files changed, 11 insertions, 18 deletions
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)