From ba83466e1da75d9260ebbb145215d9c46d6eadf6 Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Sun, 30 May 2021 10:35:40 +0200 Subject: Squashed 'gitstatus/' changes from 6d00edd0..113f1f69 113f1f69 release gitstatusd-linux-x86_64 v1.5.0 e193be52 expose HEAD's commit message 815301f1 do not redefine `exec` and `builtin` in bash bindings (#235) 97c2aa17 Make `--version-glob` to receive an argument (#216) 95e549fd Support building on OpenBSD (#208) b054ddf2 make homebrew instructions work on systems other than darwin-x86_64 (#205) 98f99ade fix brew formula check git-subtree-dir: gitstatus git-subtree-split: 113f1f698667d12906d97e3818aec5d760dc6e3d --- src/git.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/git.cc') diff --git a/src/git.cc b/src/git.cc index 029b02bf..552100cb 100644 --- a/src/git.cc +++ b/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 -- cgit v1.2.3