Commit f428ae615b4386e78cb337386b3d8e190e921766

nulltoken 2011-03-19T08:19:34

Slightly enforce copy_recurs() behavior The folder creation is now decorrelated from the recursive parsing of the source tree structure.

diff --git a/tests/t12-repo.c b/tests/t12-repo.c
index 9b8933f..38e3509 100644
--- a/tests/t12-repo.c
+++ b/tests/t12-repo.c
@@ -196,7 +196,6 @@ BEGIN_TEST(open2, "Open a bare repository with a relative path escaping out of t
 	must_pass(gitfo_getcwd(current_workdir, sizeof(current_workdir)));
 	strcpy(path_repository, current_workdir);
 	git__joinpath_n(path_repository, 3, path_repository, TEMP_REPO_FOLDER, "a/d/e.git");
-	must_pass(gitfo_mkdir_recurs(path_repository, mode));
 	must_pass(copydir_recurs(REPOSITORY_FOLDER, path_repository));
 
 	/* Change the current working directory */
diff --git a/tests/test_helpers.c b/tests/test_helpers.c
index 5884611..1d34535 100644
--- a/tests/test_helpers.c
+++ b/tests/test_helpers.c
@@ -141,7 +141,7 @@ int copy_file(const char *src, const char *dst)
 	if (gitfo_read_file(&source_buf, src) < GIT_SUCCESS)
 		return GIT_ENOTFOUND;
 
-	dst_fd = gitfo_creat(dst, 0644);
+	dst_fd = gitfo_creat_force(dst, 0644);
 	if (dst_fd < 0)
 		goto cleanup;
 
@@ -211,18 +211,13 @@ typedef struct {
 
 static int copy_filesystem_element_recurs(void *_data, char *source)
 {
-	const int mode = 0755; /* or 0777 ? */
 	copydir_data *data = (copydir_data *)_data;
 
 	data->dst[data->dst_len] = 0;
 	git__joinpath(data->dst, data->dst, source + data->src_len);
 
-	if (gitfo_isdir(source) == GIT_SUCCESS) {
-		if (gitfo_mkdir(data->dst, mode) < GIT_SUCCESS)
-			return GIT_EOSERR;
-
+	if (gitfo_isdir(source) == GIT_SUCCESS)
 		return gitfo_dirent(source, GIT_PATH_MAX, copy_filesystem_element_recurs, _data);
-	}
 
 	return copy_file(source, data->dst);
 }