Skip to main content

head_commit_message

Function head_commit_message 

Source
pub fn head_commit_message(root: &Path) -> Option<String>
Expand description

HEAD’s commit message, as a single string with newlines preserved between subject and body. The subject is the first line; everything after the first blank line is the body.

Returns None when:

  • git isn’t on PATH
  • root (or any ancestor) isn’t inside a git repo
  • the repo has no commits yet (HEAD is unborn)
  • the git log invocation otherwise exits non-zero

Used by the git_commit_message rule kind. Same advisory posture as the rest of the git module: a non-git workspace silently no-ops the rule rather than raising a hard error.