core: Make local-clone handle nested refs/heads directories
This commit is contained in:
parent
788dfe89e1
commit
8d935f46c4
|
|
@ -39,10 +39,10 @@ typedef struct {
|
|||
} OtLocalCloneData;
|
||||
|
||||
static gboolean
|
||||
copy_dir_contents (GFile *src,
|
||||
GFile *dest,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
copy_dir_contents_recurse (GFile *src,
|
||||
GFile *dest,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *child_src = NULL;
|
||||
|
|
@ -65,9 +65,20 @@ copy_dir_contents (GFile *src,
|
|||
g_clear_object (&child_dest);
|
||||
child_dest = g_file_get_child (dest, name);
|
||||
|
||||
if (!g_file_copy (child_src, child_dest, G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS,
|
||||
cancellable, NULL, NULL, error))
|
||||
goto out;
|
||||
if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
|
||||
{
|
||||
if (!ot_gfile_ensure_directory (child_dest, FALSE, error))
|
||||
goto out;
|
||||
|
||||
if (!copy_dir_contents_recurse (child_src, child_dest, cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_file_copy (child_src, child_dest, G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS,
|
||||
cancellable, NULL, NULL, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
g_clear_object (&file_info);
|
||||
}
|
||||
|
|
@ -230,14 +241,14 @@ ostree_builtin_local_clone (int argc, char **argv, GFile *repo_path, GError **er
|
|||
|
||||
src_dir = g_file_resolve_relative_path (src_repo_dir, "refs/heads");
|
||||
dest_dir = g_file_resolve_relative_path (dest_repo_dir, "refs/heads");
|
||||
if (!copy_dir_contents (src_dir, dest_dir, NULL, error))
|
||||
if (!copy_dir_contents_recurse (src_dir, dest_dir, NULL, error))
|
||||
goto out;
|
||||
g_clear_object (&src_dir);
|
||||
g_clear_object (&dest_dir);
|
||||
|
||||
src_dir = g_file_resolve_relative_path (src_repo_dir, "tags");
|
||||
dest_dir = g_file_resolve_relative_path (dest_repo_dir, "tags");
|
||||
if (!copy_dir_contents (src_dir, dest_dir, NULL, error))
|
||||
if (!copy_dir_contents_recurse (src_dir, dest_dir, NULL, error))
|
||||
goto out;
|
||||
|
||||
ret = TRUE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue