/** * Packs all non-symbolic, loose refs into packed-refs. * * @throws java.io.IOException */ public void packRefs() throws IOException { Collection<Ref> refs = repo.getRefDatabase() .getRefsByPrefix(Constants.R_REFS); List<String> refsToBePacked = new ArrayList<>(refs.size()); pm.beginTask(JGitText.get().packRefs, refs.size()); try { for (Ref ref : refs) { checkCancelled(); if (!ref.isSymbolic() && ref.getStorage().isLoose()) refsToBePacked.add(ref.getName()); pm.update(1); } ((RefDirectory) repo.getRefDatabase()).pack(refsToBePacked); } finally { pm.endTask(); } }
private void deleteCommand(RemoteRefUpdate u) { final Ref r = newRefs.remove(u.getRemoteName()); if (r == null) { // Already gone. // u.setStatus(Status.OK); return; } if (r.getStorage().isPacked()) packedRefUpdates.add(u); if (r.getStorage().isLoose()) { try { dest.deleteRef(u.getRemoteName()); u.setStatus(Status.OK); } catch (IOException e) { u.setStatus(Status.REJECTED_OTHER_REASON); u.setMessage(e.getMessage()); } } try { dest.deleteRefLog(u.getRemoteName()); } catch (IOException e) { u.setStatus(Status.REJECTED_OTHER_REASON); u.setMessage(e.getMessage()); } }
/** {@inheritDoc} */ @Override public Ref peel(Ref ref) throws IOException { final Ref leaf = ref.getLeaf(); if (leaf.isPeeled() || leaf.getObjectId() == null) return ref; ObjectIdRef newLeaf = doPeel(leaf); // Try to remember this peeling in the cache, so we don't have to do // it again in the future, but only if the reference is unchanged. if (leaf.getStorage().isLoose()) { RefList<LooseRef> curList = looseRefs.get(); int idx = curList.find(leaf.getName()); if (0 <= idx && curList.get(idx) == leaf) { LooseRef asPeeled = ((LooseRef) leaf).peel(newLeaf); RefList<LooseRef> newList = curList.set(idx, asPeeled); looseRefs.compareAndSet(curList, newList); } } return recreate(ref, newLeaf); }
if (dst.getStorage().isLoose()) { update.unlock(); delete(fileFor(name), levels);
private void deleteCommand(RemoteRefUpdate u) { final Ref r = newRefs.remove(u.getRemoteName()); if (r == null) { // Already gone. // u.setStatus(Status.OK); return; } if (r.getStorage().isPacked()) packedRefUpdates.add(u); if (r.getStorage().isLoose()) { try { dest.deleteRef(u.getRemoteName()); u.setStatus(Status.OK); } catch (IOException e) { u.setStatus(Status.REJECTED_OTHER_REASON); u.setMessage(e.getMessage()); } } try { dest.deleteRefLog(u.getRemoteName()); } catch (IOException e) { u.setStatus(Status.REJECTED_OTHER_REASON); u.setMessage(e.getMessage()); } }
if (dst.getStorage().isLoose()) { update.unlock(); delete(fileFor(name), levels);
/** * Packs all non-symbolic, loose refs into packed-refs. * * @throws java.io.IOException */ public void packRefs() throws IOException { Collection<Ref> refs = repo.getRefDatabase() .getRefsByPrefix(Constants.R_REFS); List<String> refsToBePacked = new ArrayList<>(refs.size()); pm.beginTask(JGitText.get().packRefs, refs.size()); try { for (Ref ref : refs) { checkCancelled(); if (!ref.isSymbolic() && ref.getStorage().isLoose()) refsToBePacked.add(ref.getName()); pm.update(1); } ((RefDirectory) repo.getRefDatabase()).pack(refsToBePacked); } finally { pm.endTask(); } }
private void deleteCommand(final RemoteRefUpdate u) { final Ref r = newRefs.remove(u.getRemoteName()); if (r == null) { // Already gone. // u.setStatus(Status.OK); return; } if (r.getStorage().isPacked()) packedRefUpdates.add(u); if (r.getStorage().isLoose()) { try { dest.deleteRef(u.getRemoteName()); u.setStatus(Status.OK); } catch (IOException e) { u.setStatus(Status.REJECTED_OTHER_REASON); u.setMessage(e.getMessage()); } } try { dest.deleteRefLog(u.getRemoteName()); } catch (IOException e) { u.setStatus(Status.REJECTED_OTHER_REASON); u.setMessage(e.getMessage()); } }
/** * Packs all non-symbolic, loose refs into packed-refs. * * @throws IOException */ public void packRefs() throws IOException { Collection<Ref> refs = repo.getRefDatabase().getRefs(Constants.R_REFS).values(); List<String> refsToBePacked = new ArrayList<String>(refs.size()); pm.beginTask(JGitText.get().packRefs, refs.size()); try { for (Ref ref : refs) { if (!ref.isSymbolic() && ref.getStorage().isLoose()) refsToBePacked.add(ref.getName()); pm.update(1); } ((RefDirectory) repo.getRefDatabase()).pack(refsToBePacked); } finally { pm.endTask(); } }
@Override public Ref peel(final Ref ref) throws IOException { final Ref leaf = ref.getLeaf(); if (leaf.isPeeled() || leaf.getObjectId() == null) return ref; ObjectIdRef newLeaf = doPeel(leaf); // Try to remember this peeling in the cache, so we don't have to do // it again in the future, but only if the reference is unchanged. if (leaf.getStorage().isLoose()) { RefList<LooseRef> curList = looseRefs.get(); int idx = curList.find(leaf.getName()); if (0 <= idx && curList.get(idx) == leaf) { LooseRef asPeeled = ((LooseRef) leaf).peel(newLeaf); RefList<LooseRef> newList = curList.set(idx, asPeeled); looseRefs.compareAndSet(curList, newList); } } return recreate(ref, newLeaf); }
/** {@inheritDoc} */ @Override public Ref peel(Ref ref) throws IOException { final Ref leaf = ref.getLeaf(); if (leaf.isPeeled() || leaf.getObjectId() == null) return ref; ObjectIdRef newLeaf = doPeel(leaf); // Try to remember this peeling in the cache, so we don't have to do // it again in the future, but only if the reference is unchanged. if (leaf.getStorage().isLoose()) { RefList<LooseRef> curList = looseRefs.get(); int idx = curList.find(leaf.getName()); if (0 <= idx && curList.get(idx) == leaf) { LooseRef asPeeled = ((LooseRef) leaf).peel(newLeaf); RefList<LooseRef> newList = curList.set(idx, asPeeled); looseRefs.compareAndSet(curList, newList); } } return recreate(ref, newLeaf); }
if (dst.getStorage().isLoose()) { update.unlock(); delete(fileFor(name), levels);
public static ArrayMemory valueOf(Ref.Storage storage) { ArrayMemory memory = new ArrayMemory(); memory.refOfIndex("loose").assign(storage.isLoose()); memory.refOfIndex("packed").assign(storage.isPacked()); return memory; }