aboutsummaryrefslogtreecommitdiff
path: root/gitstatus/src/git.cc
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2021-05-30 11:35:40 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2021-05-30 11:35:40 +0300
commitf217e4a39a284f6db7be7a4cfde8647085f97865 (patch)
tree112ee2c9ed6b2c572665e6cb6c872c977a5a9455 /gitstatus/src/git.cc
parent77fa0e6dcc56d71590967714f9e76bbf2c9ecc17 (diff)
parentba83466e1da75d9260ebbb145215d9c46d6eadf6 (diff)
Merge commit 'ba83466e1da75d9260ebbb145215d9c46d6eadf6'
Diffstat (limited to 'gitstatus/src/git.cc')
-rw-r--r--gitstatus/src/git.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gitstatus/src/git.cc b/gitstatus/src/git.cc
index 029b02bf..552100cb 100644
--- a/gitstatus/src/git.cc
+++ b/gitstatus/src/git.cc
@@ -239,4 +239,12 @@ PushRemotePtr GetPushRemote(git_repository* repo, const git_reference* local) {
return PushRemotePtr(res.release());
}
+CommitMessage GetCommitMessage(git_repository* repo, const git_oid& id) {
+ git_commit* commit;
+ VERIFY(!git_commit_lookup(&commit, repo, &id)) << GitError();
+ ON_SCOPE_EXIT(=) { git_commit_free(commit); };
+ return {.encoding = git_commit_message_encoding(commit) ?: "",
+ .summary = git_commit_summary(commit) ?: ""};
+}
+
} // namespace gitstatus