@Override public final void fetchNewData(Repository local, Ref ref, Optional<Integer> fetchLimit, ProgressListener progress) { Preconditions.checkState(!fetchLimit.isPresent(), "A sparse clone cannot be shallow."); FetchCommitGatherer gatherer = new FetchCommitGatherer(getRemoteWrapper(), local); gatherer.traverse(ref.getObjectId()); Stack<ObjectId> needed = gatherer.commits; while (!needed.empty()) { ObjectId commitId = needed.pop(); // If the last commit is empty, add it anyways to preserve parentage of new commits. boolean allowEmpty = needed.isEmpty(); fetchSparseCommit(local, commitId, allowEmpty); } }
@Override public final void fetchNewData(Repository local, Ref ref, Optional<Integer> fetchLimit, ProgressListener progress) { Preconditions.checkState(!fetchLimit.isPresent(), "A sparse clone cannot be shallow."); FetchCommitGatherer gatherer = new FetchCommitGatherer(getRemoteWrapper(), local); try { gatherer.traverse(ref.getObjectId()); Stack<ObjectId> needed = gatherer.commits; while (!needed.empty()) { ObjectId commitId = needed.pop(); // If the last commit is empty, add it anyways to preserve parentage of new commits. boolean allowEmpty = needed.isEmpty(); fetchSparseCommit(local, commitId, allowEmpty); } } catch (Exception e) { Throwables.propagate(e); } finally { } }