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
|
|
|
|
2017-03-05 21:46:49 +00:00
|
|
|
# Set marker, that we running tests from `git commit`,
|
2018-04-16 15:05:50 +00:00
|
|
|
# so some tests will be skipped. It is done, because `git rev-parse`
|
2017-03-05 21:46:49 +00:00
|
|
|
# is not working when running from pre-commit hook.
|
|
|
|
export BATS_RUNNING_FROM_GIT=1
|
|
|
|
|
2016-02-24 10:46:57 +00:00
|
|
|
# Run tests:
|
|
|
|
make test
|
2016-02-23 21:51:52 +00:00
|
|
|
|
2017-03-27 18:51:33 +00:00
|
|
|
if [[ "$BRANCH_NAME" == "master" ]]; 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
|