--- main.c.orig	Tue Oct 31 22:27:53 2006
+++ main.c	Thu Oct  4 18:08:35 2007
@@ -624,11 +624,29 @@
   node_baton_t *pb = parent_baton;
   edit_baton_t *eb = pb->edit_baton;
   node_baton_t *db = apr_palloc(pool, sizeof(*db));
+  svn_error_t *err;
 
-  SVN_ERR(eb->wrapped_editor->open_directory(path, pb->wrapped_node_baton,
+  err = eb->wrapped_editor->open_directory(path, pb->wrapped_node_baton,
                                              base_revision, pool,
-                                             &db->wrapped_node_baton));
+                                             &db->wrapped_node_baton);
+  if (!err)
+    goto success;
 
+  if (err->apr_err != SVN_ERR_FS_NOT_DIRECTORY)
+    return err;
+
+  /*
+   * In case we try to open a non-existent directory, this means we did
+   * not have visibility on the parent path when this directory was created,
+   * so just create it now.
+   */
+  svn_error_clear (err);
+  SVN_ERR(eb->wrapped_editor->add_directory(path, pb->wrapped_node_baton,
+                                            /*copyfrom_path*/ NULL,
+                                            /*copyfrom_revision*/SVN_INVALID_REVNUM,
+                                            pool,
+                                            &db->wrapped_node_baton));
+  success:
   db->edit_baton = eb;
   *child_baton = db;
 


