Skip to content

Conversation

@PeskyPotato
Copy link
Contributor

This PR is in reference to gohugoio/hugo#10905 to make the full commit message (body) visible in the GitInfo.

The changes I've done in the three commits are outlined below:

  • Modified the git log command to include %b in the format to show the commit message body.
  • Changed the GitInfo type stryct to include Body.
  • \x1d is used to separate the GitInfo items from file names, instead of new lines as done previously. This is because a commit message body can have new lines. File names are then split by new lines this results in a new array being created.
  • The commit message body is trimmed for empty spaces and new lines in the toGitInfo function.
  • Commit messages with no body have an empty string appended to the end of the array in the toGitInfo function so every commit will have either the Body if available or an empty string.
  • Added TestCommitMessage and AssertMessage functions to assert the Subject and Body of commit messages for three different files. One with a Subject and no Body, one with a Subject and single line Body and one with a Subject and multi-line body.

I'm not very familar with Golang to may have made simple errors, please feel free to point out any improvements that could be done.

Thanks!

- Exposes commit body
- Adds tests for commit subject and body
- This is a multi-line
- commit body
@bep bep merged commit bec72b8 into bep:master Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants