git-secret/utils/hooks/pre-commit.sh

22 lines
346 B
Bash
Raw Normal View History

2016-02-23 21:11:37 +00:00
#!/usr/bin/env bash
2016-02-21 13:26:17 +00:00
set -e
2016-07-02 10:24:32 +00:00
BRANCH_NAME=$(git branch | grep '\*' | sed 's/* //')
2016-02-23 10:12:44 +00:00
2016-07-02 13:18:53 +00:00
if [[ "$BRANCH_NAME" != '(no branch)' ]]; then
2016-02-24 10:46:57 +00:00
unset GIT_WORK_TREE
2016-02-21 13:26:17 +00:00
2016-02-24 10:46:57 +00:00
# Run tests:
make test
2016-02-23 21:51:52 +00:00
2016-07-02 13:18:53 +00:00
if [[ "$BRANCH_NAME" == "staging" ]]; then
2016-02-24 10:46:57 +00:00
# Build new manuals:
make build-man
# Add new files:
git add man/man1/*
2016-03-13 10:10:45 +00:00
git add man/man7/*
2016-02-24 10:46:57 +00:00
fi
2016-02-24 10:26:05 +00:00
fi