if (dst.getStorage().isLoose()) { update.unlock(); delete(fileFor(name), levels);
boolean peeled = false; for (Ref r : refs) { if (r.getStorage().isPacked() && r.isPeeled()) { peeled = true; break;
boolean peeled = false; for (Ref r : refs) { if (r.getStorage().isPacked() && r.isPeeled()) { peeled = true; break;
boolean peeled = false; for (final Ref r : refs) { if (r.getStorage().isPacked() && r.isPeeled()) { peeled = true; break;
if (dst.getStorage().isLoose()) { update.unlock(); delete(fileFor(name), levels);
if (dst.getStorage().isLoose()) { update.unlock(); delete(fileFor(name), levels);
/** * Make sure a ref is peeled and has the Storage PACKED. If the given ref * has this attributes simply return it. Otherwise create a new peeled * {@link ObjectIdRef} where Storage is set to PACKED. * * @param f * @return a ref for Storage PACKED having the same name, id, peeledId as f * @throws MissingObjectException * @throws IOException */ private Ref peeledPackedRef(Ref f) throws MissingObjectException, IOException { if (f.getStorage().isPacked() && f.isPeeled()) { return f; } if (!f.isPeeled()) { f = peel(f); } ObjectId peeledObjectId = f.getPeeledObjectId(); if (peeledObjectId != null) { return new ObjectIdRef.PeeledTag(PACKED, f.getName(), f.getObjectId(), peeledObjectId); } else { return new ObjectIdRef.PeeledNonTag(PACKED, f.getName(), f.getObjectId()); } }
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()); } }
/** * 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(); } }
/** * Make sure a ref is peeled and has the Storage PACKED. If the given ref * has this attributes simply return it. Otherwise create a new peeled * {@link ObjectIdRef} where Storage is set to PACKED. * * @param f * @return a ref for Storage PACKED having the same name, id, peeledId as f * @throws MissingObjectException * @throws IOException */ private Ref peeledPackedRef(Ref f) throws MissingObjectException, IOException { if (f.getStorage().isPacked() && f.isPeeled()) { return f; } if (!f.isPeeled()) { f = peel(f); } ObjectId peeledObjectId = f.getPeeledObjectId(); if (peeledObjectId != null) { return new ObjectIdRef.PeeledTag(PACKED, f.getName(), f.getObjectId(), peeledObjectId); } else { return new ObjectIdRef.PeeledNonTag(PACKED, f.getName(), f.getObjectId()); } }
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); }
/** * Make sure a ref is peeled and has the Storage PACKED. If the given ref * has this attributes simply return it. Otherwise create a new peeled * {@link ObjectIdRef} where Storage is set to PACKED. * * @param f * @return a ref for Storage PACKED having the same name, id, peeledId as f * @throws MissingObjectException * @throws IOException */ private Ref peeledPackedRef(Ref f) throws MissingObjectException, IOException { if (f.getStorage().isPacked() && f.isPeeled()) { return f; } if (!f.isPeeled()) { f = peel(f); } ObjectId peeledObjectId = f.getPeeledObjectId(); if (peeledObjectId != null) { return new ObjectIdRef.PeeledTag(PACKED, f.getName(), f.getObjectId(), peeledObjectId); } else { return new ObjectIdRef.PeeledNonTag(PACKED, f.getName(), f.getObjectId()); } }
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); }
/** * 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(); } }