final RevBlob Q_txt = src.blob("new text");
final RevCommit Q = src.commit().add("Q", Q_txt).create();
final Repository db = src.getRepository();
final String dstName = Constants.R_HEADS + "new.branch";
Transport t;
PushResult result;
t = Transport.open(db, remoteURI);
try {
final String srcExpr = Q.name();
final boolean forceUpdate = false;
final String localName = null;
final ObjectId oldId = null;
RemoteRefUpdate update = new RemoteRefUpdate(src.getRepository(),
srcExpr, dstName, forceUpdate, localName, oldId);
result = t.push(NullProgressMonitor.INSTANCE, Collections
.singleton(update));
} finally {
t.close();
}
assertTrue(remoteRepository.hasObject(Q_txt));
assertNotNull("has " + dstName, remoteRepository.getRef(dstName));
assertEquals(Q, remoteRepository.getRef(dstName).getObjectId());
fsck(remoteRepository, Q);
List<AccessEvent> requests = getRequests();
assertEquals(2, requests.size());
AccessEvent service = requests.get(1);
assertEquals("POST", service.getMethod());
assertEquals(join(remoteURI, "git-receive-pack"), service.getPath());
assertEquals(200, service.getStatus());
assertEquals("message line 1\n" //
+ "error: no soup for you!\n" //
+ "come back next year!\n", //
result.getMessages());
}