}
public void testFetchUpdateExisting() throws Exception {
// Bootstrap by doing the clone.
//
TestRepository dst = createTestRepository();
Transport t = Transport.open(dst.getRepository(), remoteURI);
try {
t.fetch(NullProgressMonitor.INSTANCE, mirror(master));
} finally {
t.close();
}
assertEquals(B, dst.getRepository().getRef(master).getObjectId());
List<AccessEvent> cloneRequests = getRequests();
// Force enough into the local client that enumeration will
// need multiple packets, but not too many to overflow and
// not pick up the ACK_COMMON message.
//
TestRepository.BranchBuilder b = dst.branch(master);
for (int i = 0; i < 32 - 1; i++)
b.commit().tick(3600 /* 1 hour */).message("c" + i).create();
// Create a new commit on the remote.
//
b = new TestRepository(remoteRepository).branch(master);
RevCommit Z = b.commit().message("Z").create();
// Now incrementally update.
//
t = Transport.open(dst.getRepository(), remoteURI);
try {
t.fetch(NullProgressMonitor.INSTANCE, mirror(master));
} finally {
t.close();
}
assertEquals(Z, dst.getRepository().getRef(master).getObjectId());
List<AccessEvent> requests = getRequests();
requests.removeAll(cloneRequests);
assertEquals(3, requests.size());