Helps prevents commits to origin/master
by first fetching the status of the repository. If the repository is advertised (via API endpoint) as closed the commit is blocked, locally. Conversely, if the repository is open the commit is accepted.
This repository is comprised of two pieces:
- A WordPress plugin that creates an endpoint (example.com/repo-status/) for advertising a project repository status.
- A trio of Bash scripts that are installed as various Git hooks.
curl -O https://raw.githubusercontent.com/scottlee/repo-safety-net/master/bin/rsn.sh
chmod +x rsn.sh
- Optional:
sudo mv rsn.sh /usr/local/bin/rsn
- Clone this repo.
- Activate the plugin.
- Configure. (Plugins > Repo Safety Net)
- Clone a project repository as you normally would.
- Install the pre-commit hook via rsn.sh
rsn install -p example.com/repo-status/ -t vip
Note: The trailing slash is required for the URL. - Check the status of any repo with
rsn status
for the current dir orrsn status ~/repos/my-awesome-project
to check a different one. - Help is available with
rsn help
install
: Install the plugin for the current directory.
Params:
-p
The remote url generated by the plugin.-t
The type of repo. Optional. Currently acceptsvip
orgit-only
as valid options. Default isgit-only
. This parameter dictates which git hooks are installed.
status
: Get the status of a repo. Accepts a path to a repo or checks the current directory is nothing is passed
Example: rsn status
or rsn status ~/repos/my-awesome-project
help
: Generates help information.
Currently, changing repo types can be done by removing the installed git hooks manually from the. .git/hooks folder and then runnning rsn install
with the new repo type.