From: Han-Wen Nienhuys Date: Sun, 21 Jul 2019 20:24:56 +0000 (+0200) Subject: dfs: use RefDatabase API for exactRef in ReftableBatchRefUpdate X-Git-Tag: v5.6.0.201911271000-m3~120 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=434e6c732aeb098e251f4785ab97994433e5463f;p=jgit.git dfs: use RefDatabase API for exactRef in ReftableBatchRefUpdate This removes one use of DFS specific code in this class. Signed-off-by: Han-Wen Nienhuys Change-Id: I3ef6a4b98357cc6dc480892244ddc51d2fd751a2 --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/ReftableBatchRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/ReftableBatchRefUpdate.java index 07fd00f149..682e15664c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/ReftableBatchRefUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/ReftableBatchRefUpdate.java @@ -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 pending) + private boolean checkExpected(List 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);