jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1536604 - in /jackrabbit/oak/trunk/oak-mk/src: main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java test/java/org/apache/jackrabbit/mk/MicroKernelImplTest.java
Date Tue, 29 Oct 2013 08:19:07 GMT
Author: mreutegg
Date: Tue Oct 29 08:19:06 2013
New Revision: 1536604

URL: http://svn.apache.org/r1536604
Log:
OAK-1122: Empty branch commit returns head revision on trunk

Modified:
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/MicroKernelImplTest.java

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java?rev=1536604&r1=1536603&r2=1536604&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java
Tue Oct 29 08:19:06 2013
@@ -411,7 +411,7 @@ public class MicroKernelImpl implements 
             throw new IllegalArgumentException("absolute path expected: " + path);
         }
         if (jsonDiff == null || jsonDiff.length() == 0) {
-            return getHeadRevision();
+            return revisionId != null ? revisionId : getHeadRevision();
         }
 
         Id revId = revisionId == null ? getHeadRevisionId() : Id.fromString(revisionId);

Modified: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/MicroKernelImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/MicroKernelImplTest.java?rev=1536604&r1=1536603&r2=1536604&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/MicroKernelImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/MicroKernelImplTest.java
Tue Oct 29 08:19:06 2013
@@ -401,4 +401,16 @@ public class MicroKernelImplTest {
         assertTrue(trunkNode.contains("\"q\":43"));
     }
 
+    @Test // OAK-1122
+    public void emptyCommit() {
+        String rev = mk.getHeadRevision();
+        assertEquals("empty commit must return current head revision",
+                rev, mk.commit("/", "", rev, null));
+        // now the same on a branch
+        rev = mk.branch(rev);
+        // commit something to branch
+        rev = mk.commit("/", "+\"x\":{}", rev, null);
+        assertEquals("empty branch commit must return current head of branch revision",
+                rev, mk.commit("/", "", rev, null));
+    }
 }



Mime
View raw message