new RefWriter(refs.values()) {
@Override
protected void writeFile(final String name, final byte[] content)
throws IOException {
final File file = new File(db.getDirectory(), name);
final LockFile lck = new LockFile(file, db.getFS());
if (!lck.lock())
throw new ObjectWritingException(MessageFormat.format(CLIText.get().cantWrite, file));
try {
lck.write(content);
} catch (IOException ioe) {
throw new ObjectWritingException(MessageFormat.format(CLIText.get().cantWrite, file));
}
if (!lck.commit())
throw new ObjectWritingException(MessageFormat.format(CLIText.get().cantWrite, file));
}
}.writePackedRefs();
}