Author: pburba
Date: Thu Dec 20 23:35:12 2012
New Revision: 1424759

URL: http://svn.apache.org/viewvc?rev=1424759&view=rev
Log:
Fix a harmless(?) looking bug where we cached empty inherited properties
during the initial check out of a repository root.

Found by: philip

See http://svn.haxx.se/dev/archive-2012-12/0427.shtml

* subversion/libsvn_client/iprops.c

  (need_to_cache_iprops): If we are checking out the repos root we don't
   need a cache.

  (svn_client__get_inheritable_props): Pass the RA session to
   need_to_cache_iprops so it can detect checkouts of the repos root.


Modified:
    subversion/trunk/subversion/libsvn_client/iprops.c

Modified: subversion/trunk/subversion/libsvn_client/iprops.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/iprops.c?rev=1424759&r1=1424758&r2=1424759&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/iprops.c (original)
+++ subversion/trunk/subversion/libsvn_client/iprops.c Thu Dec 20 23:35:12 2012
@@ -41,10 +41,12 @@
 /*** Code. ***/
 
 /* Determine if LOCAL_ABSPATH needs an inherited property cache.  If it does,
-   then set *NEEDS_CACHE to TRUE, set it to FALSE otherwise. */
+   then set *NEEDS_CACHE to TRUE, set it to FALSE otherwise.  All other args
+   are as per svn_client__get_inheritable_props(). */
 static svn_error_t *
 need_to_cache_iprops(svn_boolean_t *needs_cache,
                      const char *local_abspath,
+                     svn_ra_session_t *ra_session,
                      svn_client_ctx_t *ctx,
                      apr_pool_t *scratch_pool)
 {
@@ -71,7 +73,25 @@ need_to_cache_iprops(svn_boolean_t *need
         }
     }
 
-  *needs_cache = (is_wc_root || is_switched);
+  /* Starting assumption. */
+  *needs_cache = FALSE;
+
+  if (is_wc_root || is_switched)
+    {
+      const char *session_url;
+      const char *session_root_url;
+
+      /* Looks likely that we need an inherited properties cache...Unless
+         LOCAL_ABSPATH is a WC root that points to the repos root.  Then it
+         doesn't need a cache because it has nowhere to inherit from.  Check
+         for that case. */
+      SVN_ERR(svn_ra_get_session_url(ra_session, &session_url, scratch_pool));
+      SVN_ERR(svn_ra_get_repos_root2(ra_session, &session_root_url,
+                                     scratch_pool));
+
+      if (strcmp(session_root_url, session_url) != 0)
+        *needs_cache = TRUE;
+    }
 
   return SVN_NO_ERROR;
 }
@@ -112,7 +132,7 @@ svn_client__get_inheritable_props(apr_ha
           svn_boolean_t needs_cached_iprops;
 
           SVN_ERR(need_to_cache_iprops(&needs_cached_iprops, local_abspath,
-                                       ctx, iterpool));
+                                       ra_session, ctx, iterpool));
           if (needs_cached_iprops)
             {
               const char *target_abspath = apr_pstrdup(scratch_pool,


Reply via email to