/// <exception cref="System.IO.IOException"></exception>
        protected internal override RefUpdate.Result DoUpdate(RefUpdate.Result status)
        {
            WriteConfig wc = database.GetRepository().GetConfig().Get(WriteConfig.KEY);

            Lock.SetFSync(wc.GetFSyncRefFiles());
            Lock.SetNeedStatInformation(true);
            Lock.Write(GetNewObjectId());
            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(RefUpdate.Result.LOCK_FAILURE);
            }
            database.Stored(this, Lock.GetCommitSnapshot());
            return(status);
        }