#git #git-hooks

mit-commit

For building commit linters. This makes it eas.

49 releases (stable)

new 1.29.7 Apr 14, 2021
1.25.0 Feb 15, 2021
1.21.0 Dec 22, 2020
1.19.0 Nov 4, 2020
0.17.0 Jun 30, 2020

#108 in Parser implementations

Download history 38/week @ 2020-12-22 28/week @ 2020-12-29 219/week @ 2021-01-05 177/week @ 2021-01-12 207/week @ 2021-01-19 96/week @ 2021-01-26 56/week @ 2021-02-02 81/week @ 2021-02-09 672/week @ 2021-02-16 22/week @ 2021-02-23 20/week @ 2021-03-02 74/week @ 2021-03-09 1/week @ 2021-03-16 87/week @ 2021-03-23 479/week @ 2021-03-30 185/week @ 2021-04-06

694 downloads per month

CC0 license

135KB
2.5K 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

~1.4–2.2MB
~59K SLoC