diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java index cc9db5f77..d381ddd41 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java @@ -727,17 +727,17 @@ public void pack(List refs) throws IOException { pack(refs, Collections.emptyMap()); } - PackedRefList pack(Map heldLocks) throws IOException { - return pack(heldLocks.keySet(), heldLocks); + void pack(Map heldLocks) throws IOException { + pack(heldLocks.keySet(), heldLocks); } - private PackedRefList pack(Collection refs, + private void pack(Collection refs, Map heldLocks) throws IOException { for (LockFile ol : heldLocks.values()) { ol.requireLock(); } if (refs.isEmpty()) { - return null; + return; } FS fs = parent.getFS(); @@ -778,12 +778,11 @@ private PackedRefList pack(Collection refs, } if (!dirty) { // All requested refs were already packed accurately - return packed; + return; } // The new content for packed-refs is collected. Persist it. - PackedRefList result = commitPackedRefs(lck, cur, packed, - false); + commitPackedRefs(lck, cur, packed,false); // Now delete the loose refs which are now packed for (String refName : refs) { @@ -834,7 +833,6 @@ private PackedRefList pack(Collection refs, } // Don't fire refsChanged. The refs have not change, only their // storage. - return result; } finally { lck.unlock(); } @@ -1061,12 +1059,9 @@ private static String copy(String src, int off, int end) { return new StringBuilder(end - off).append(src, off, end).toString(); } - PackedRefList commitPackedRefs(final LockFile lck, final RefList refs, + void commitPackedRefs(final LockFile lck, final RefList refs, final PackedRefList oldPackedList, boolean changed) throws IOException { - // Can't just return packedRefs.get() from this method; it might have been - // updated again after writePackedRefs() returns. - AtomicReference result = new AtomicReference<>(); new RefWriter(refs) { @Override protected void writeFile(String name, byte[] content) @@ -1112,10 +1107,8 @@ protected void writeFile(String name, byte[] content) if (changed) { modCnt.incrementAndGet(); } - result.set(newPackedList); } }.writePackedRefs(); - return result.get(); } private Ref readRef(String name, RefList packed) throws IOException {