@@ -191,12 +191,36 @@ public virtual Tree CreateTree(TreeDefinition treeDefinition)
191191 /// <param name="tree">The <see cref="Tree"/> of the <see cref="Commit"/> to be created.</param>
192192 /// <param name="parents">The parents of the <see cref="Commit"/> to be created.</param>
193193 /// <returns>The created <see cref="Commit"/>.</returns>
194+ [ Obsolete ]
194195 public virtual Commit CreateCommit ( string message , Signature author , Signature committer , Tree tree , IEnumerable < Commit > parents )
195196 {
196- return CreateCommit ( message , author , committer , tree , parents , null ) ;
197+ return CreateCommit ( author , committer , message , true , tree , parents , null ) ;
197198 }
198199
199- internal Commit CreateCommit ( string message , Signature author , Signature committer , Tree tree , IEnumerable < Commit > parents , string referenceName )
200+ /// <summary>
201+ /// Inserts a <see cref="Commit"/> into the object database, referencing an existing <see cref="Tree"/>.
202+ /// </summary>
203+ /// <param name="author">The <see cref="Signature"/> of who made the change.</param>
204+ /// <param name="committer">The <see cref="Signature"/> of who added the change to the repository.</param>
205+ /// <param name="message">The description of why a change was made to the repository.</param>
206+ /// <param name="prettifyMessage">True to prettify the message, or false to leave it as is</param>
207+ /// <param name="tree">The <see cref="Tree"/> of the <see cref="Commit"/> to be created.</param>
208+ /// <param name="parents">The parents of the <see cref="Commit"/> to be created.</param>
209+ /// <returns>The created <see cref="Commit"/>.</returns>
210+ /// <para>
211+ /// Prettifing the message includes:
212+ /// * Removing empty lines from the beginning and end.
213+ /// * Removing trailing spaces from every line.
214+ /// * Turning multiple consecutive empty lines between paragraphs into just one empty line.
215+ /// * Ensuring the commit message ends with a newline.
216+ /// * Removing every line starting with "#".
217+ /// </para>
218+ public virtual Commit CreateCommit ( Signature author , Signature committer , string message , bool prettifyMessage , Tree tree , IEnumerable < Commit > parents )
219+ {
220+ return CreateCommit ( author , committer , message , prettifyMessage , tree , parents , null ) ;
221+ }
222+
223+ internal Commit CreateCommit ( Signature author , Signature committer , string message , bool prettifyMessage , Tree tree , IEnumerable < Commit > parents , string referenceName )
200224 {
201225 Ensure . ArgumentNotNull ( message , "message" ) ;
202226 Ensure . ArgumentDoesNotContainZeroByte ( message , "message" ) ;
@@ -205,10 +229,13 @@ internal Commit CreateCommit(string message, Signature author, Signature committ
205229 Ensure . ArgumentNotNull ( tree , "tree" ) ;
206230 Ensure . ArgumentNotNull ( parents , "parents" ) ;
207231
208- string prettifiedMessage = Proxy . git_message_prettify ( message ) ;
232+ if ( prettifyMessage )
233+ {
234+ message = Proxy . git_message_prettify ( message ) ;
235+ }
209236 GitOid [ ] parentIds = parents . Select ( p => p . Id . Oid ) . ToArray ( ) ;
210237
211- ObjectId commitId = Proxy . git_commit_create ( repo . Handle , referenceName , author , committer , prettifiedMessage , tree , parentIds ) ;
238+ ObjectId commitId = Proxy . git_commit_create ( repo . Handle , referenceName , author , committer , message , tree , parentIds ) ;
212239
213240 return repo . Lookup < Commit > ( commitId ) ;
214241 }
0 commit comments