lck.setFSync(true);
lck.setNeedSnapshot(true);
try {
lck.write(content);
} catch (IOException ioe) {
throw new ObjectWritingException(MessageFormat.format(JGitText.get().unableToWrite, name), ioe);
}
try {
lck.waitForStatChange();
} catch (InterruptedException e) {
lck.unlock();
throw new ObjectWritingException(MessageFormat.format(JGitText.get().interruptedWriting, name));
}
if (!lck.commit())
throw new ObjectWritingException(MessageFormat.format(JGitText.get().unableToWrite, name));
byte[] digest = Constants.newMessageDigest().digest(content);
packedRefs.compareAndSet(oldPackedList, new PackedRefList(refs,
lck.getCommitSnapshot(), ObjectId.fromRaw(digest)));
}