You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2018/10/07 18:01:32 UTC

svn commit: r1843070 - /subversion/branches/better-pristines/subversion/libsvn_wc/wc_db_wcroot.c

Author: brane
Date: Sun Oct  7 18:01:32 2018
New Revision: 1843070

URL: http://svn.apache.org/viewvc?rev=1843070&view=rev
Log:
[On the better-pristines branch]

* subversion/libsvn_wc/wc_db_wcroot.c: Do not include private/svn_fspath.h.
  (svn_wc__format_from_context): Find the format in context more carefully,
   considering that there may be an exact match in the wcroot hash.

Modified:
    subversion/branches/better-pristines/subversion/libsvn_wc/wc_db_wcroot.c

Modified: subversion/branches/better-pristines/subversion/libsvn_wc/wc_db_wcroot.c
URL: http://svn.apache.org/viewvc/subversion/branches/better-pristines/subversion/libsvn_wc/wc_db_wcroot.c?rev=1843070&r1=1843069&r2=1843070&view=diff
==============================================================================
--- subversion/branches/better-pristines/subversion/libsvn_wc/wc_db_wcroot.c (original)
+++ subversion/branches/better-pristines/subversion/libsvn_wc/wc_db_wcroot.c Sun Oct  7 18:01:32 2018
@@ -31,7 +31,6 @@
 #include "svn_pools.h"
 #include "svn_version.h"
 
-#include "private/svn_fspath.h"
 #include "private/svn_sorts_private.h"
 
 #include "wc.h"
@@ -1064,19 +1063,36 @@ svn_wc__format_from_context(int *format,
                                         svn_sort_compare_paths);
 
   /* If the previous key is a parent of the local_abspath, use its format. */
-  if (index > 0)
-    {
-      const char* const parent = APR_ARRAY_IDX(keys, index - 1, const char*);
-      const char* const common =
-        svn_fspath__get_longest_ancestor(parent, local_abspath, scratch_pool);
-
-      if (0 == strcmp(common, parent))
-        {
-          svn_wc__db_wcroot_t *wcroot = svn_hash_gets(dir_data, parent);
-          *format = wcroot->format;
-          return SVN_NO_ERROR;
-        }
-    }
+  {
+    const char *const here = (index >= keys->nelts ? NULL
+                              : APR_ARRAY_IDX(keys, index, const char*));
+    const char *const prev = (index == 0 ? NULL
+                              : APR_ARRAY_IDX(keys, index - 1, const char*));
+
+    if (here)
+      {
+        const char *const child = svn_dirent_skip_ancestor(here, local_abspath);
+        if (child && !*child)
+          {
+            /* Found an exact match in the WC context. */
+            svn_wc__db_wcroot_t *wcroot = svn_hash_gets(dir_data, here);
+            *format = wcroot->format;
+            return SVN_NO_ERROR;
+          }
+      }
+
+    if (prev)
+      {
+        const char *const child = svn_dirent_skip_ancestor(prev, local_abspath);
+        if (child)
+          {
+            /* Found the parent path in the WC context. */
+            svn_wc__db_wcroot_t *wcroot = svn_hash_gets(dir_data, prev);
+            *format = wcroot->format;
+            return SVN_NO_ERROR;
+          }
+      }
+  }
 
   /* Find the oldest format recorded in the WC context. */
   {