RevCommit.carryFlags(c, carry);
}
+ /**
+ * Assume additional commits are shallow (have no parents).
+ *
+ * @param ids
+ * commits that should be treated as shallow commits, in addition
+ * to any commits already known to be shallow by the repository.
+ */
+ public void assumeShallow(Collection<? extends ObjectId> ids) {
+ for (ObjectId id : ids)
+ lookupCommit(id).parents = RevCommit.NO_PARENTS;
+ }
+
void initializeShallowCommits() throws IOException {
if (shallowCommitsInitialized)
throw new IllegalStateException(
if (depth != 0)
processShallow();
+ if (!clientShallowCommits.isEmpty())
+ walk.assumeShallow(clientShallowCommits);
sendPack = negotiate();
} catch (PackProtocolException err) {
reportErrorDuringNegotiate(err.getMessage());
// Commits not on the boundary which are shallow in the client
// need to become unshallowed
- if (c.getDepth() < depth && clientShallowCommits.contains(c)) {
+ if (c.getDepth() < depth && clientShallowCommits.remove(c)) {
unshallowCommits.add(c.copy());
pckOut.writeString("unshallow " + c.name()); //$NON-NLS-1$
}
try {
pw.setIndexDisabled(true);
pw.setUseCachedPacks(true);
- pw.setUseBitmaps(true);
+ pw.setUseBitmaps(depth == 0 && clientShallowCommits.isEmpty());
pw.setReuseDeltaCommits(true);
pw.setDeltaBaseAsOffset(options.contains(OPTION_OFS_DELTA));
pw.setThin(options.contains(OPTION_THIN_PACK));