File tree Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ public class Commit : GitObject
2121 private readonly ILazy < Signature > lazyAuthor ;
2222 private readonly ILazy < Signature > lazyCommitter ;
2323 private readonly ILazy < string > lazyMessage ;
24+ private readonly ILazy < string > lazyMessageRaw ;
2425 private readonly ILazy < string > lazyMessageShort ;
2526 private readonly ILazy < string > lazyEncoding ;
2627
@@ -43,6 +44,7 @@ internal Commit(Repository repo, ObjectId id)
4344 lazyCommitter = group1 . AddLazy ( Proxy . git_commit_committer ) ;
4445 group2 = new GitObjectLazyGroup ( this . repo , id ) ;
4546 lazyMessage = group2 . AddLazy ( Proxy . git_commit_message ) ;
47+ lazyMessageRaw = group2 . AddLazy ( Proxy . git_commit_message_raw ) ;
4648 lazyMessageShort = group2 . AddLazy ( Proxy . git_commit_summary ) ;
4749 lazyEncoding = group2 . AddLazy ( RetrieveEncodingOf ) ;
4850
@@ -66,6 +68,11 @@ public virtual TreeEntry this[string relativePath]
6668 /// </summary>
6769 public virtual string Message { get { return lazyMessage . Value ; } }
6870
71+ /// <summary>
72+ /// Gets the raw, unmodified commit message.
73+ /// </summary>
74+ public virtual string MessageRaw { get { return lazyMessageRaw . Value ; } }
75+
6976 /// <summary>
7077 /// Gets the short commit message which is usually the first line of the commit.
7178 /// </summary>
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public static CommitRewriteInfo From(Commit commit)
3131 {
3232 Author = commit . Author ,
3333 Committer = commit . Committer ,
34- Message = commit . Message
34+ Message = commit . MessageRaw
3535 } ;
3636 }
3737
Original file line number Diff line number Diff line change @@ -422,6 +422,10 @@ internal static extern unsafe int git_commit_create_with_signature(
422422 [ return : MarshalAs ( UnmanagedType . CustomMarshaler , MarshalCookie = UniqueId . UniqueIdentifier , MarshalTypeRef = typeof ( LaxUtf8NoCleanupMarshaler ) ) ]
423423 internal static extern unsafe string git_commit_message ( git_object * commit ) ;
424424
425+ [ DllImport ( libgit2 , CallingConvention = CallingConvention . Cdecl ) ]
426+ [ return : MarshalAs ( UnmanagedType . CustomMarshaler , MarshalCookie = UniqueId . UniqueIdentifier , MarshalTypeRef = typeof ( LaxUtf8NoCleanupMarshaler ) ) ]
427+ internal static extern unsafe string git_commit_message_raw ( git_object * commit ) ;
428+
425429 [ DllImport ( libgit2 , CallingConvention = CallingConvention . Cdecl ) ]
426430 [ return : MarshalAs ( UnmanagedType . CustomMarshaler , MarshalCookie = UniqueId . UniqueIdentifier , MarshalTypeRef = typeof ( LaxUtf8NoCleanupMarshaler ) ) ]
427431 internal static extern unsafe string git_commit_summary ( git_object * commit ) ;
Original file line number Diff line number Diff line change @@ -388,6 +388,11 @@ public static unsafe string git_commit_message(ObjectHandle obj)
388388 return NativeMethods . git_commit_message ( obj ) ;
389389 }
390390
391+ public static unsafe string git_commit_message_raw ( ObjectHandle obj )
392+ {
393+ return NativeMethods . git_commit_message_raw ( obj ) ;
394+ }
395+
391396 public static unsafe string git_commit_summary ( ObjectHandle obj )
392397 {
393398 return NativeMethods . git_commit_summary ( obj ) ;
You can’t perform that action at this time.
0 commit comments