git-secret/utils/hooks/pre-commit.sh
Jonas Karlsson 54f74ede6a Fix for windows (#375)
* add test for travis-ci windows support
* Make 'ps' command options platform specific *nix/windows
* Add _clean_path for windows,  apply to all homedir input arguments
* export GITSECRET_DIST="windows" in git hook if running windows
* Bash lint fixes
2019-03-09 18:49:45 -05:00

30 lines
652 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 skipped. It is done, because `git rev-parse`
# is not working when running from pre-commit hook. See #334
export BATS_RUNNING_FROM_GIT=1
if [[ "$(uname -s)" == MINGW* ]]; then
export GITSECRET_DIST="windows"
fi
# 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