subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1705638 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
Date Mon, 28 Sep 2015 09:52:11 GMT
Author: stefan2
Date: Mon Sep 28 09:52:11 2015
New Revision: 1705638

URL: http://svn.apache.org/viewvc?rev=1705638&view=rev
Log:
Make the "properties changed" tests in FSFS precise even in the case of
MD5 collisions.  The added comparison overhead is minimal with our usage
patterns.

* subversion/libsvn_fs_fs/fs_fs.c
  (svn_fs_fs__prop_rep_equal): If two separate prop reps have the same
                               MD5, still do a full comparison to be sure.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1705638&r1=1705637&r2=1705638&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Mon Sep 28 09:52:11 2015
@@ -1485,14 +1485,27 @@ svn_fs_fs__prop_rep_equal(svn_boolean_t
       && !svn_fs_fs__id_txn_used(&rep_a->txn_id)
       && !svn_fs_fs__id_txn_used(&rep_b->txn_id))
     {
-      /* MD5 must be given. Having the same checksum is good enough for
-         accepting the prop lists as equal. */
-      *equal = memcmp(rep_a->md5_digest, rep_b->md5_digest,
-                      sizeof(rep_a->md5_digest)) == 0;
-      return SVN_NO_ERROR;
+      /* Same representation? */
+      if (   (rep_a->revision == rep_b->revision)
+          && (rep_a->item_index == rep_b->item_index))
+        {
+          *equal = TRUE;
+          return SVN_NO_ERROR;
+        }
+
+      /* Known different content? MD5 must be given. */
+      if (!memcmp(rep_a->md5_digest, rep_b->md5_digest,
+                  sizeof(rep_a->md5_digest)))
+        {
+          *equal = FALSE;
+          return SVN_NO_ERROR;
+        }
     }
 
-  /* Same path in same txn? */
+  /* Same path in same txn?
+   *
+   * For committed reps, IDs cannot be the same here b/c we already know
+   * that they point to different representations. */
   if (svn_fs_fs__id_eq(a->id, b->id))
     {
       *equal = TRUE;



Mime
View raw message