You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2012/07/13 21:23:07 UTC

svn commit: r1361341 - /subversion/trunk/subversion/libsvn_wc/lock.c

Author: rhuijben
Date: Fri Jul 13 19:23:06 2012
New Revision: 1361341

URL: http://svn.apache.org/viewvc?rev=1361341&view=rev
Log:
Avoid looking for a parent working copy when we can just ask the current
working copy if the current path is the root (via +- a hash table lookup).

This avoids problems in 1.7+ similar to those reported in 1.6 as
"/.svn/wc.db: Permission denied" that could be worked around via
SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_CHECK_FOR_WC_NG

* subversion/libsvn_wc/lock.c
  (svn_wc__acquire_write_lock): Don't check for an anchor if we are already
    at the wcroot.

Found by: Roy Mammen <RoyMMammen{_AT_}yahoo.com>
Patch by: me

Modified:
    subversion/trunk/subversion/libsvn_wc/lock.c

Modified: subversion/trunk/subversion/libsvn_wc/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/lock.c?rev=1361341&r1=1361340&r2=1361341&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/lock.c (original)
+++ subversion/trunk/subversion/libsvn_wc/lock.c Fri Jul 13 19:23:06 2012
@@ -1529,6 +1529,21 @@ svn_wc__acquire_write_lock(const char **
                              svn_dirent_local_style(local_abspath,
                                                     scratch_pool));
 
+  if (lock_anchor && kind == svn_kind_dir)
+    {
+      svn_boolean_t is_wcroot;
+
+      SVN_ERR_ASSERT(lock_root_abspath != NULL);
+
+      /* Perform a cheap check to avoid looking for a parent working copy,
+         which might be very expensive in some specific scenarios */
+      SVN_ERR(svn_wc__db_is_wcroot(&is_wcroot, db, local_abspath,
+                                   scratch_pool));
+
+      if (is_wcroot)
+        lock_anchor = FALSE;
+    }
+
   if (lock_anchor)
     {
       const char *parent_abspath;