/// <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);
        }
示例#2
0
        /// <exception cref="System.IO.IOException"></exception>
        private void WriteReflog(Repository db, ObjectId newId, string msg, string refName
                                 )
        {
            RefDirectory       refs   = (RefDirectory)db.RefDatabase;
            RefDirectoryUpdate update = ((RefDirectoryUpdate)refs.NewUpdate(refName, true));

            update.SetNewObjectId(newId);
            refs.Log(update, msg, true);
        }