Exemplo n.º 1
0
        /// <exception cref="System.IO.IOException"></exception>
        private void Commit(string commitMsg, PersonIdent author, PersonIdent committer)
        {
            NGit.CommitBuilder commit = new NGit.CommitBuilder();
            commit.Author    = author;
            commit.Committer = committer;
            commit.Message   = commitMsg;
            ObjectInserter inserter = db.NewObjectInserter();
            ObjectId       id;

            try
            {
                commit.TreeId = inserter.Insert(new TreeFormatter());
                id            = inserter.Insert(commit);
                inserter.Flush();
            }
            finally
            {
                inserter.Release();
            }
            int       nl = commitMsg.IndexOf('\n');
            RefUpdate ru = db.UpdateRef(Constants.HEAD);

            ru.SetNewObjectId(id);
            ru.SetRefLogMessage("commit : " + ((nl == -1) ? commitMsg : Sharpen.Runtime.Substring
                                                   (commitMsg, 0, nl)), false);
            ru.ForceUpdate();
        }