public bool Commit()
{
if (_os != null)
{
Unlock();
throw new InvalidOperationException("Lock on " + _refFile + " not closed.");
}
SaveStatInformation();
if (_lockFile.RenameTo(_refFile.FullName))
{
return true;
}
_refFile.Refresh();
if (!_refFile.Exists || _refFile.DeleteFile())
if (_lockFile.RenameTo(_refFile.FullName))
return true;
Unlock();
return false;
}
protected override RefUpdateResult doUpdate(RefUpdateResult status) { _lock.setNeedStatInformation(true); _lock.Write(NewObjectId); string msg = getRefLogMessage(); if (msg != null) { if (isRefLogIncludingResult()) { string strResult = toResultString(status); if (strResult != null) { if (msg.Length > 0) { msg = msg + ": " + strResult; } else { msg = strResult; } } } _database.log(this, msg, true); } if (!_lock.Commit()) { return(RefUpdateResult.LOCK_FAILURE); } _database.stored(this, _lock.CommitLastModified); return(status); }