Implement support for git hooks #94
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added experimental support for git hooks as specially named tasks:
Running
dswith the--sync-git-hooksflag will discover a.gitrepository in your current repository (or parent repos) and install / update all hooks defined in your config into the.git/hooks/directory. Arguments will be passed as normal to tasks.This feature is experimental and opt-in, mostly because I can't figure out a good way to always keep the
.git/hooks/directory in sync with the task listing. The problem is that if you install a hook and then remove all hooks from the task listing: this looks identical to never having the hooks installed at all, and syncing the hooks stomps on all the installed hooks from other tools if you have them. I toyed with the idea of adding a separate config section for hooks specifically, but that ended up being awkward to implement with all the supported task config formats.This branch ships with full unit tests and 100% code coverage (outside the pre-existing miss on
runners.py 115-118), as well as docs/readmes.