Index: /trunk/src/apps/svnsync-vbox/main.c
===================================================================
--- /trunk/src/apps/svnsync-vbox/main.c	(revision 48251)
+++ /trunk/src/apps/svnsync-vbox/main.c	(revision 48252)
@@ -1242,4 +1242,5 @@
   svn_boolean_t prev_process_default, process_default;
   svn_boolean_t prev_process_recursive, process_recursive;
+  svn_boolean_t added_ancestor_dir; /* This dir or its ancestors were added in this changeset */
   svn_boolean_t ignore_everything; /* Ignore operations on this dir/file. */
   svn_boolean_t ignore_everything_rec; /* Recursively ignore operations on subdirs/files. */
@@ -1291,8 +1292,16 @@
   apr_hash_t *fileprops;
   apr_hash_index_t *hi;
-
-  SVN_ERR(eb->wrapped_editor->add_file(dst_path, wrapped_parent_node_baton,
-                                       NULL, SVN_IGNORED_REVNUM, pool,
-                                       &fb->wrapped_node_baton));
+  svn_error_t *e = NULL;
+
+  e = eb->wrapped_editor->add_file(dst_path, wrapped_parent_node_baton,
+                                   NULL, SVN_IGNORED_REVNUM, pool,
+                                   &fb->wrapped_node_baton);
+  if (e)
+  {
+    svn_error_clear(e);
+    SVN_ERR(eb->wrapped_editor->open_file(dst_path, wrapped_parent_node_baton,
+                                          SVN_IGNORED_REVNUM, pool,
+                                          &fb->wrapped_node_baton));
+  }
 
   subpool = svn_pool_create(pool);
@@ -1602,4 +1611,5 @@
     {
       /* Genuinely add a new dir, referring to other revision/name if known. */
+      b->added_ancestor_dir = TRUE;
       SVN_ERR(eb->wrapped_editor->add_directory(path, pb->wrapped_node_baton,
                                                 copyfrom_path,
@@ -1664,7 +1674,8 @@
   node_baton_t *db = apr_pcalloc(pool, sizeof(*db));
   svn_boolean_t dir_added_this_changeset = FALSE;
-  svn_boolean_t dir_present_in_target = TRUE;
+  svn_boolean_t dir_present_in_target = FALSE;
 
   DX(fprintf(stderr, "open_directory %s\n", path);)
+  db->added_ancestor_dir = pb->added_ancestor_dir;
   db->ignore_everything_rec = pb->ignore_everything_rec;
   db->ignore_everything = db->ignore_everything_rec;
@@ -1676,7 +1687,7 @@
      * a change to some file in the directory is in one changeset. */
     SVN_ERR(svn_ra_check_path(eb->from_session_prop, STRIP_LEADING_SLASH(path),
-                              eb->current-1,
-                              &nodekind, pool));
-    dir_added_this_changeset = (nodekind != svn_node_dir);
+                              eb->current-1, &nodekind, pool));
+    dir_added_this_changeset =    db->added_ancestor_dir
+                               || (nodekind != svn_node_dir);
     if (!dir_added_this_changeset)
     {
@@ -1696,4 +1707,8 @@
       }
     }
+    else
+    {
+      dir_present_in_target = TRUE;
+    }
     SVN_ERR(get_props_sync(eb->from_session_prop, eb->default_process,
                            pb->process_default, pb->process_recursive, path,
@@ -1746,4 +1761,5 @@
         /* Directory appears due to changes to the process settings. */
         eb->changeset_live = TRUE;
+        db->added_ancestor_dir = TRUE;
         SVN_ERR(eb->wrapped_editor->add_directory(path, pb->wrapped_node_baton,
                                                   NULL, SVN_IGNORED_REVNUM, pool,
