1#!/usr/bin/env bash 2 3set -e 4 5BRANCH_NAME=$(git branch | grep '\*' | sed 's/* //') 6 7if [[ "$BRANCH_NAME" != '(no branch)' ]]; then 8 unset GIT_WORK_TREE 9 10 # Set marker, that we running tests from `git commit`, 11 # so some tests will be skipped. It is done, because `git rev-parse` 12 # is not working when running from pre-commit hook. 13 export BATS_RUNNING_FROM_GIT=1 14 15 # Run tests: 16 make test 17 18 if [[ "$BRANCH_NAME" == "master" ]]; then 19 # Build new manuals: 20 make build-man 21 22 # Add new files: 23 git add man/man1/* 24 git add man/man7/* 25 fi 26fi 27