]> source.dussan.org Git - jgit.git/commitdiff
dfs: use RefDatabase API for exactRef in ReftableBatchRefUpdate 47/146447/25
authorHan-Wen Nienhuys <hanwen@google.com>
Sun, 21 Jul 2019 20:24:56 +0000 (22:24 +0200)
committerHan-Wen Nienhuys <hanwen@google.com>
Wed, 11 Sep 2019 11:01:56 +0000 (13:01 +0200)
This removes one use of DFS specific code in this class.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I3ef6a4b98357cc6dc480892244ddc51d2fd751a2

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/ReftableBatchRefUpdate.java

index 07fd00f149a5cafeb90e514687c89898484178cb..682e15664cf13ca4b9fb3804fe373d0d86061f98 100644 (file)
@@ -141,8 +141,7 @@ public class ReftableBatchRefUpdate extends BatchRefUpdate {
 
                        lock.lock();
                        try {
-                               Reftable table = refdb.reader();
-                               if (!checkExpected(table, pending)) {
+                               if (!checkExpected(pending)) {
                                        return;
                                }
                                if (!checkConflicting(pending)) {
@@ -236,10 +235,10 @@ public class ReftableBatchRefUpdate extends BatchRefUpdate {
                return ok;
        }
 
-       private boolean checkExpected(Reftable table, List<ReceiveCommand> pending)
+       private boolean checkExpected(List<ReceiveCommand> pending)
                        throws IOException {
                for (ReceiveCommand cmd : pending) {
-                       if (!matchOld(cmd, table.exactRef(cmd.getRefName()))) {
+                       if (!matchOld(cmd, refdb.exactRef(cmd.getRefName()))) {
                                cmd.setResult(LOCK_FAILURE);
                                if (isAtomic()) {
                                        ReceiveCommand.abort(pending);