From commits-return-49546-archive-asf-public=cust-asf.ponee.io@subversion.apache.org Sun Oct 7 20:01:26 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6672A18064E for ; Sun, 7 Oct 2018 20:01:26 +0200 (CEST) Received: (qmail 34874 invoked by uid 500); 7 Oct 2018 18:01:25 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 34864 invoked by uid 99); 7 Oct 2018 18:01:25 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Oct 2018 18:01:25 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 3DDD53A01AC for ; Sun, 7 Oct 2018 18:01:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1843070 - /subversion/branches/better-pristines/subversion/libsvn_wc/wc_db_wcroot.c Date: Sun, 07 Oct 2018 18:01:32 -0000 To: commits@subversion.apache.org From: brane@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20181007180133.3DDD53A01AC@svn01-us-west.apache.org> 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. */ {