private TransferSummary callInternal(IRemoteRepo remoteRepo) {
final Remote remote = this.remote;
@Nullable
String localRefSpec;
@Nullable
String remoteRefSpec;
boolean force;
TransferSummary sendPackResult = new TransferSummary();
for (TransferableRef ref : this.refsToPush) {
localRefSpec = ref.getLocalRef();
remoteRefSpec = ref.getRemoteRef();
force = ref.isForceUpdate();
if (ref.isDelete()) {
Optional<Ref> deleted = remoteRepo.deleteRef(remoteRefSpec);
if (deleted.isPresent()) {
RefDiff deleteResult = RefDiff.added(deleted.get());
sendPackResult.add(remote.getPushURL(), deleteResult);
}
} else {
Optional<Ref> localRef = refParse(localRefSpec);
checkState(localRef.isPresent(), "RefSpec %s does not exist", localRefSpec);
Optional<Ref> newRef = push(remoteRepo, remote, localRef.get(), remoteRefSpec);
if (newRef.isPresent()) {
RefDiff deleteResult = new RefDiff(localRef.get(), newRef.get());
sendPackResult.add(remote.getPushURL(), deleteResult);
}
}
}
return sendPackResult;
}