summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r--pkg/commands/git.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index a98ad42d1..f4fb4a424 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -501,6 +501,13 @@ func (c *GitCommand) GetHeadCommitMessage() (string, error) {
return strings.TrimSpace(message), err
}
+func (c *GitCommand) GetCommitMessage(commitSha string) (string, error) {
+ cmdStr := "git rev-list --format=%B --max-count=1 " + commitSha
+ messageWithHeader, err := c.OSCommand.RunCommandWithOutput(cmdStr)
+ message := strings.Join(strings.SplitAfter(messageWithHeader, "\n")[1:], "\n")
+ return strings.TrimSpace(message), err
+}
+
// AmendHead amends HEAD with whatever is staged in your working tree
func (c *GitCommand) AmendHead() (*exec.Cmd, error) {
command := "git commit --amend --no-edit --allow-empty"