// metadata files so it is properly initialized during the push.
//
if (!updates.isEmpty() && isNewRepository())
createNewRepository(updates);
RefWriter refWriter = new RefWriter(newRefs.values()) {
@Override
protected void writeFile(String file, byte[] content)
throws IOException {
dest.writeFile(ROOT_DIR + file, content);
}
};
if (!packedRefUpdates.isEmpty()) {
try {
refWriter.writePackedRefs();
for (final RemoteRefUpdate u : packedRefUpdates)
u.setStatus(Status.OK);
} catch (IOException err) {
for (final RemoteRefUpdate u : packedRefUpdates) {
u.setStatus(Status.REJECTED_OTHER_REASON);
u.setMessage(err.getMessage());
}
throw new TransportException(uri, JGitText.get().failedUpdatingRefs, err);
}
}
try {
refWriter.writeInfoRefs();
} catch (IOException err) {
throw new TransportException(uri, JGitText.get().failedUpdatingRefs, err);
}
}