#git #git-hooks

mit-commit

For building commit linters. This makes it eas.

68 releases (stable)

new 3.1.5 Jan 30, 2023
3.1.4 Oct 12, 2022
3.1.3 Sep 12, 2022
3.1.2 Jul 6, 2022
0.17.0 Jun 30, 2020

#158 in Parser implementations

Download history 609/week @ 2022-10-08 912/week @ 2022-10-15 234/week @ 2022-10-22 292/week @ 2022-10-29 430/week @ 2022-11-05 348/week @ 2022-11-12 206/week @ 2022-11-19 66/week @ 2022-11-26 604/week @ 2022-12-03 242/week @ 2022-12-10 444/week @ 2022-12-17 80/week @ 2022-12-24 68/week @ 2022-12-31 100/week @ 2023-01-07 558/week @ 2023-01-14 564/week @ 2023-01-21

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

CC0 license

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

~2.2–3MB
~74K SLoC