| Crates.io | git-hooks-manager |
| lib.rs | git-hooks-manager |
| version | 0.4.2 |
| created_at | 2020-12-11 18:10:48.898516+00 |
| updated_at | 2020-12-13 14:14:05.178268+00 |
| description | An attempt to make sharing git hooks among team members easier |
| homepage | |
| repository | https://github.com/paulollivier/git-hooks |
| max_upload_size | |
| id | 321923 |
| size | 120,646 |
= Git Hook Manager Paul Ollivier contact@paulollivier.fr
This project is an attempt to provide a way to easily share https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks[git hooks].
In many teams, we rely on a full suite of tooling, and the need to share code conventions and quality standards.
This tool tries to unify git hook management via the well-known shared repository dotfiles mechanisms.
== Installation
Grab yourself a copy from https://github.com/paulollivier/git-hooks/releases/latest[the latest release page], chmod +x it, and put it in one of the directories in your $PATH.
May I recommend ~/.local/bin?
Or, if you have cargo: cargo install git-hooks-manager.
In this case, the binary will be found in ~/.cargo/bin.
== Usage
$ git-hooks --help git-hooks Paul Ollivier contact@paulollivier.fr A git hooks manager
USAGE: git-hooks [SUBCOMMAND]
FLAGS: -h, --help Prints help information -V, --version Prints version information
If you are starting a new project, or at least trying git-hooks on a new project, you should run git-hooks init.
This will setup the project to run git-hooks on git events.
If you want to run a hook collection manually, you can call git-hooks run <event>:
git-hooks-run Runs the configured hooks for a given event
USAGE:
git-hooks run
FLAGS: -h, --help Prints help information -V, --version Prints version information
ARGS:
=== Using & writing hooks
This is covered in link:hooks.adoc[it's own page].
== Design doc
I am convinced Rust is the language to go regarding system tooling, for its performance and error handling design.
The solution has 3 parts:
rust repository may contain the definitions of a rustfmt, cargo check, or even cargo test hook.pre-commit, post-commit, …)=== The .hooks.yml file
This file is expected to be found at the root of the git repository. It contains definitions to be read by the main binary.
repos:
=== A hook definitions repository
This is a simple git repository, with a hooks.yml at its root.
.hooks.yml!
The dotted version is to use the git hook manager for the current repo, the non-dotted version is for hooks definitions!hooks:
=== The git-hooks binary
==== Roles
.hooks.yml hooks section overrides hooks.yml definition if set{file}, {files}, {root}, {changed_files}
** [x] restrict execution to specified file regexps
** [x] run only when the git index contains the specified file regexps