Author: stefan2
Date: Sun Feb  8 15:57:58 2015
New Revision: 1658199

URL: http://svn.apache.org/r1658199
Log:
* subversion/libsvn_ra_svn/editorp.c
  (ra_svn_handle_add_file,
   ra_svn_handle_open_file): Minor optimization. Checking paths for being
                             canonical is faster than canonicalizing them.

Modified:
    subversion/trunk/subversion/libsvn_ra_svn/editorp.c

Modified: subversion/trunk/subversion/libsvn_ra_svn/editorp.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/editorp.c?rev=1658199&r1=1658198&r2=1658199&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/editorp.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/editorp.c Sun Feb  8 15:57:58 2015
@@ -686,7 +686,10 @@ static svn_error_t *ra_svn_handle_add_fi
                                   &file_token, &copy_path, &copy_rev));
   SVN_ERR(lookup_token(ds, token, FALSE, &entry));
   ds->file_refs++;
-  path = svn_relpath_canonicalize(path, pool);
+
+  /* The PATH should be canonical .. but never trust incoming data. */
+  if (!svn_relpath_is_canonical(path))
+    path = svn_relpath_canonicalize(path, pool);
 
   /* Some operations pass COPY_PATH as a full URL (commits, etc.).
      Others (replay, e.g.) deliver an fspath.  That's ... annoying. */
@@ -718,7 +721,11 @@ static svn_error_t *ra_svn_handle_open_f
                                   &file_token, &rev));
   SVN_ERR(lookup_token(ds, token, FALSE, &entry));
   ds->file_refs++;
-  path = svn_relpath_canonicalize(path, pool);
+
+  /* The PATH should be canonical .. but never trust incoming data. */
+  if (!svn_relpath_is_canonical(path))
+    path = svn_relpath_canonicalize(path, pool);
+
   file_entry = store_token(ds, NULL, file_token, TRUE, ds->file_pool);
   SVN_CMD_ERR(ds->editor->open_file(path, entry->baton, rev, ds->file_pool,
                                     &file_entry->baton));


Reply via email to