Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use raw commit message when rewriting history #2172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rstarkov wants to merge 1 commit into libgit2:master
base: master
Choose a base branch
Loading
from rstarkov:rs/rewrite-raw
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions LibGit2Sharp/Commit.cs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class Commit : GitObject
private readonly ILazy<Signature> lazyAuthor;
private readonly ILazy<Signature> lazyCommitter;
private readonly ILazy<string> lazyMessage;
private readonly ILazy<string> lazyMessageRaw;
private readonly ILazy<string> lazyMessageShort;
private readonly ILazy<string> lazyEncoding;

Expand All @@ -43,6 +44,7 @@ internal Commit(Repository repo, ObjectId id)
lazyCommitter = group1.AddLazy(Proxy.git_commit_committer);
group2 = new GitObjectLazyGroup(this.repo, id);
lazyMessage = group2.AddLazy(Proxy.git_commit_message);
lazyMessageRaw = group2.AddLazy(Proxy.git_commit_message_raw);
lazyMessageShort = group2.AddLazy(Proxy.git_commit_summary);
lazyEncoding = group2.AddLazy(RetrieveEncodingOf);

Expand All @@ -66,6 +68,11 @@ public virtual TreeEntry this[string relativePath]
/// </summary>
public virtual string Message { get { return lazyMessage.Value; } }

/// <summary>
/// Gets the raw, unmodified commit message.
/// </summary>
public virtual string MessageRaw { get { return lazyMessageRaw.Value; } }

/// <summary>
/// Gets the short commit message which is usually the first line of the commit.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/CommitRewriteInfo.cs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static CommitRewriteInfo From(Commit commit)
{
Author = commit.Author,
Committer = commit.Committer,
Message = commit.Message
Message = commit.MessageRaw
};
}

Expand Down
4 changes: 4 additions & 0 deletions LibGit2Sharp/Core/NativeMethods.cs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ internal static extern unsafe int git_commit_create_with_signature(
[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
internal static extern unsafe string git_commit_message(git_object* commit);

[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
internal static extern unsafe string git_commit_message_raw(git_object* commit);

[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
internal static extern unsafe string git_commit_summary(git_object* commit);
Expand Down
5 changes: 5 additions & 0 deletions LibGit2Sharp/Core/Proxy.cs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ public static unsafe string git_commit_message(ObjectHandle obj)
return NativeMethods.git_commit_message(obj);
}

public static unsafe string git_commit_message_raw(ObjectHandle obj)
{
return NativeMethods.git_commit_message_raw(obj);
}

public static unsafe string git_commit_summary(ObjectHandle obj)
{
return NativeMethods.git_commit_summary(obj);
Expand Down

AltStyle によって変換されたページ (->オリジナル) /