Author: julianfoad
Date: Thu Jun 16 13:44:17 2011
New Revision: 1136435

URL: http://svn.apache.org/viewvc?rev=1136435&view=rev
Log:
Fix svn_dirent_skip_ancestor() in the case where the parent path is a UNC
root path such as "//server/share".  A follow-up to r1136379.

* subversion/libsvn_subr/dirent_uri.c
  (svn_dirent_skip_ancestor): Reverse two checks, so as to omit the leading
    "/" from the result in this case.

Modified:
    subversion/trunk/subversion/libsvn_subr/dirent_uri.c

Modified: subversion/trunk/subversion/libsvn_subr/dirent_uri.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/dirent_uri.c?rev=1136435&r1=1136434&r2=1136435&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/trunk/subversion/libsvn_subr/dirent_uri.c Thu Jun 16 13:44:17 
2011
@@ -1472,16 +1472,43 @@ svn_dirent_skip_ancestor(const char *par
   if (child_dirent[len] == 0)
     return ""; /* parent_dirent == child_dirent */
 
+  /* Child == parent + more-characters */
+
   root_len = dirent_root_length(child_dirent, strlen(child_dirent));
   if (root_len > len)
-    return NULL; /* Different root */
+    /* Different root, e.g. ("" "/...") or ("//z" "//z/share") */
+    return NULL;
 
-  if (root_len == len)
-    return child_dirent + len;
+  /* Now, child == [root-of-parent] + [rest-of-parent] + more-characters.
+   * It must be one of the following forms.
+   *
+   * rlen parent    child       bad?  rlen=len? c[len]=/?
+   *  0   ""        "foo"               *
+   *  0   "b"       "bad"         !
+   *  0   "b"       "b/foo"                       *
+   *  1   "/"       "/foo"              *
+   *  1   "/b"      "/bad"        !
+   *  1   "/b"      "/b/foo"                      *
+   *  2   "a:"      "a:foo"             *
+   *  2   "a:b"     "a:bad"       !
+   *  2   "a:b"     "a:b/foo"                     *
+   *  3   "a:/"     "a:/foo"            *
+   *  3   "a:/b"    "a:/bad"      !
+   *  3   "a:/b"    "a:/b/foo"                    *
+   *  5   "//s/s"   "//s/s/foo"         *         *
+   *  5   "//s/s/b" "//s/s/bad"   !
+   *  5   "//s/s/b" "//s/s/b/foo"                 *
+   */
 
   if (child_dirent[len] == '/')
+    /* "parent|child" is one of:
+     * "[a:]b|/foo" "[a:]/b|/foo" "//s/s|/foo" "//s/s/b|/foo" */
     return child_dirent + len + 1;
 
+  if (root_len == len)
+    /* "parent|child" is "|foo" "/|foo" "a:|foo" "a:/|foo" "//s/s|/foo" */
+    return child_dirent + len;
+
   return NULL;
 }
 


Reply via email to