git-secret/utils/hooks/pre-commit.sh
sobolevn 12d4b9f6de
Adds new release process.
Changes:
1. Removed any reference of `staging` branch from docs
2. Refactored `hooks` to work with master

Closes #76
2017-03-27 21:51:33 +03:00

27 lines
560 B
Bash
Executable File

#!/usr/bin/env bash
set -e
BRANCH_NAME=$(git branch | grep '\*' | sed 's/* //')
if [[ "$BRANCH_NAME" != '(no branch)' ]]; then
unset GIT_WORK_TREE
# Set marker, that we running tests from `git commit`,
# so some tests will be skiped. It is done, because `git rev-parse`
# is not working when running from pre-commit hook.
export BATS_RUNNING_FROM_GIT=1
# Run tests:
make test
if [[ "$BRANCH_NAME" == "master" ]]; then
# Build new manuals:
make build-man
# Add new files:
git add man/man1/*
git add man/man7/*
fi
fi