def post_commit_hook ( argv ) : _ , stdout , _ = run ( "git log -1 --format=%B HEAD" ) message = "\n" . join ( stdout ) options = { "allow_empty" : True } if not _check_message ( message , options ) : click . echo ( "Commit message errors (fix with 'git commit --amend')." , file = sys . stderr ) return 1 # it should not fail with exit return 0
check git commit messages python
Hook : for checking commit message .
def post_commit_hook(argv):
    """Hook: for checking commit message."""
    _, stdout, _ = run("git log -1 --format=%B HEAD")
    message = "\n".join(stdout)
    options = {"allow_empty": True}

    if not _check_message(message, options):
        click.echo(
            "Commit message errors (fix with 'git commit --amend').",
            file=sys.stderr)
        return 1  # it should not fail with exit
    return 0