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

#662 in Parser implementations

Download history 39/week @ 2024-10-04 56/week @ 2024-10-11 256/week @ 2024-10-18 372/week @ 2024-10-25 472/week @ 2024-11-01 448/week @ 2024-11-08 372/week @ 2024-11-15 399/week @ 2024-11-22 390/week @ 2024-11-29 467/week @ 2024-12-06 308/week @ 2024-12-13 227/week @ 2024-12-20 141/week @ 2024-12-27 395/week @ 2025-01-03 432/week @ 2025-01-10 179/week @ 2025-01-17

1,176 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