예제 #1
0
        /// <summary>Write the given ref update to the ref's log</summary>
        /// <param name="update"></param>
        /// <param name="msg"></param>
        /// <param name="deref"></param>
        /// <returns>this writer</returns>
        /// <exception cref="System.IO.IOException">System.IO.IOException</exception>
        public virtual NGit.Storage.File.ReflogWriter Log(RefUpdate update, string msg, bool
                                                          deref)
        {
            ObjectId    oldId = update.GetOldObjectId();
            ObjectId    newId = update.GetNewObjectId();
            Ref         @ref  = update.GetRef();
            PersonIdent ident = update.GetRefLogIdent();

            if (ident == null)
            {
                ident = new PersonIdent(parent);
            }
            else
            {
                ident = new PersonIdent(ident);
            }
            byte[] rec = Encode(oldId, newId, ident, msg);
            if (deref && @ref.IsSymbolic())
            {
                Log(@ref.GetName(), rec);
                Log(@ref.GetLeaf().GetName(), rec);
            }
            else
            {
                Log(@ref.GetName(), rec);
            }
            return(this);
        }