#git #git-hooks

mit-commit

For building commit linters. This makes it eas.

57 stable releases

3.1.8 Sep 12, 2023
3.1.7 May 24, 2023
3.1.6 Mar 7, 2023
3.1.4 Oct 12, 2022
0.17.0 Jun 30, 2020

#343 in Parser implementations

Download history 332/week @ 2023-11-01 409/week @ 2023-11-08 219/week @ 2023-11-15 295/week @ 2023-11-22 426/week @ 2023-11-29 108/week @ 2023-12-06 261/week @ 2023-12-13 316/week @ 2023-12-20 464/week @ 2023-12-27 200/week @ 2024-01-03 100/week @ 2024-01-10 507/week @ 2024-01-17 325/week @ 2024-01-24 315/week @ 2024-01-31 217/week @ 2024-02-07 2199/week @ 2024-02-14

3,226 downloads per month
Used in 10 crates (6 directly)

CC0 license

110KB
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

~3.5–5.5MB
~95K SLoC