Expand description
A library to parse commit messages in git hooks
Make it a bit easier to write lints and for git hooks
§Example
use indoc::indoc;
use mit_commit::{Bodies, CommitMessage, Subject};
let message = CommitMessage::from(indoc!(
"
Update bashrc to include kubernetes completions
This should make it easier to deploy things for the developers.
Benchmarked with Hyperfine, no noticable performance decrease.
; Bitte geben Sie eine Commit-Beschreibung f\u{00FC}r Ihre \u{00E4}nderungen ein. Zeilen,
; die mit ';' beginnen, werden ignoriert, und eine leere Beschreibung
; bricht den Commit ab.
;
; Datum: Sat Jun 27 21:40:14 2020 +0200
;
; Auf Branch master
;
; Initialer Commit
;
; Zum Commit vorgemerkte \u{00E4}nderungen:
; neue Datei: .bashrc
;"
));
assert_eq!(
message.get_subject(),
Subject::from("Update bashrc to include kubernetes completions")
)Structs§
- Bodies
- A collection of body paragraphs from a commit message.
- Body
- A single contiguous block of [
CommitMessage] text - Comment
- A single comment from a
CommitMessage - Comments
- A collection of comments from a [
CommitMessage] - Commit
Message - A
Self, the primary entry point to the library - Scissors
- The
Scissorsfrom a [CommitMessage] - Subject
- The
Subjectfrom thecrate::CommitMessage - Trailer
- A
Traileryou might see a in a [CommitMessage], for example ‘Co-authored-by: Billie Thompson billie@example.com’ - Trailers
- A Collection of
Trailer
Enums§
- Commit
Message Error - Errors on reading commit messages
- Fragment
- A
Fragmentfrom the [CommitMessage], either a comment or body - Trailer
Error - Errors in parsing potential trailers