private void prune(final ImmutableSet<Ref> remoteRemoteRefs, final ImmutableSet<Ref> localRemoteRefs, List<RefDiff> needUpdate) { // Delete local refs that aren't in the remote List<Ref> locals = new ArrayList<Ref>(); // only branches, not tags, appear in the remoteRemoteRefs list so we will not catch // any tags in this check. However, we do not track which remote originally // provided a tag so it makes sense not to prune them anyway. for (Ref remoteRef : remoteRemoteRefs) { Optional<Ref> localRef = findLocal(remoteRef, localRemoteRefs); if (localRef.isPresent()) { locals.add(localRef.get()); } } for (Ref localRef : localRemoteRefs) { if (!(localRef instanceof SymRef) && !locals.contains(localRef)) { // Delete the ref RefDiff RefDiff = new RefDiff(localRef, null); needUpdate.add(RefDiff); command(UpdateRef.class).setDelete(true).setName(localRef.getName()).call(); } } }
private void prune(final ImmutableSet<Ref> remoteRemoteRefs, final ImmutableSet<Ref> localRemoteRefs, List<RefDiff> needUpdate) { // Delete local refs that aren't in the remote List<Ref> locals = new ArrayList<Ref>(); // only branches, not tags, appear in the remoteRemoteRefs list so we will not catch // any tags in this check. However, we do not track which remote originally // provided a tag so it makes sense not to prune them anyway. for (Ref remoteRef : remoteRemoteRefs) { Optional<Ref> localRef = findLocal(remoteRef, localRemoteRefs); if (localRef.isPresent()) { locals.add(localRef.get()); } } for (Ref localRef : localRemoteRefs) { if (!(localRef instanceof SymRef) && !locals.contains(localRef)) { // Delete the ref RefDiff RefDiff = new RefDiff(localRef, null); needUpdate.add(RefDiff); command(UpdateRef.class).setDelete(true).setName(localRef.getName()).call(); } } }
Optional<Ref> local = findLocal(remoteRef, localRemoteRefs); if (local.isPresent()) { if (!local.get().getObjectId().equals(remoteRef.getObjectId())) {
Optional<Ref> local = findLocal(remoteRef, localRemoteRefs); if (local.isPresent()) { if (!local.get().getObjectId().equals(remoteRef.getObjectId())) {