59 stable releases

3.2.1 Aug 25, 2024
3.2.0 Jul 26, 2024
3.1.8 Sep 12, 2023
3.1.7 May 24, 2023
0.17.0 Jun 30, 2020

#501 in Parser implementations

Download history 517/week @ 2024-08-17 602/week @ 2024-08-24 209/week @ 2024-08-31 70/week @ 2024-09-07 68/week @ 2024-09-14 68/week @ 2024-09-21 73/week @ 2024-09-28 29/week @ 2024-10-05 58/week @ 2024-10-12 258/week @ 2024-10-19 395/week @ 2024-10-26 473/week @ 2024-11-02 527/week @ 2024-11-09 308/week @ 2024-11-16 399/week @ 2024-11-23 400/week @ 2024-11-30

1,667 downloads per month
Used in 10 crates (6 directly)

CC0 license

120KB
2K SLoC

mit-commit

A library to parse commit messages in git hooks

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")
)

Read more at Docs.rs


lib.rs:

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")
)

Dependencies

~4.5–6.5MB
~113K SLoC