@@ -191,12 +191,36 @@ public virtual Tree CreateTree(TreeDefinition treeDefinition)
191
191
/// <param name="tree">The <see cref="Tree"/> of the <see cref="Commit"/> to be created.</param>
192
192
/// <param name="parents">The parents of the <see cref="Commit"/> to be created.</param>
193
193
/// <returns>The created <see cref="Commit"/>.</returns>
194
+ [ Obsolete ]
194
195
public virtual Commit CreateCommit ( string message , Signature author , Signature committer , Tree tree , IEnumerable < Commit > parents )
195
196
{
196
- return CreateCommit ( message , author , committer , tree , parents , null ) ;
197
+ return CreateCommit ( author , committer , message , true , tree , parents , null ) ;
197
198
}
198
199
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 )
200
224
{
201
225
Ensure . ArgumentNotNull ( message , "message" ) ;
202
226
Ensure . ArgumentDoesNotContainZeroByte ( message , "message" ) ;
@@ -205,10 +229,13 @@ internal Commit CreateCommit(string message, Signature author, Signature committ
205
229
Ensure . ArgumentNotNull ( tree , "tree" ) ;
206
230
Ensure . ArgumentNotNull ( parents , "parents" ) ;
207
231
208
- string prettifiedMessage = Proxy . git_message_prettify ( message ) ;
232
+ if ( prettifyMessage )
233
+ {
234
+ message = Proxy . git_message_prettify ( message ) ;
235
+ }
209
236
GitOid [ ] parentIds = parents . Select ( p => p . Id . Oid ) . ToArray ( ) ;
210
237
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 ) ;
212
239
213
240
return repo . Lookup < Commit > ( commitId ) ;
214
241
}
0 commit comments