Commit f428ae61 by nulltoken Committed by Vicent Marti

Slightly enforce copy_recurs() behavior

The folder creation is now decorrelated from the recursive parsing of the source tree structure.
parent ba1bdf86
......@@ -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 */
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment