File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2+ set -euo pipefail
23
3- echo " Running pre-commit hook from " ` pwd`
4- ./scripts/test.sh
4+ echo " Running pre-commit hook from $( pwd) "
55
6- # $? stores exit value of the last command
7- if [ $? -ne 0 ]; then
6+ if ! ./scripts/test.sh; then
87 echo " Tests must pass before commit!"
98 exit 1
109fi
Original file line number Diff line number Diff line change 11#! /bin/bash
2- # Run the following command in the root of your project to install this pre-push hook:
3- # cp git-hooks/pre-push .git/hooks/pre-push; chmod 700 .git/hooks/pre-push
2+ set -euo pipefail
3+
4+ # Run `./install-hooks.bash` to install this pre-push hook.
45
56# Check if we actually have commits to push
6- commits=` git log @{u}..`
7+ commits=$( git log " @{u}.." )
78if [ -z " $commits " ]; then
89 exit 0
910fi
1011
1112CMD=" ./scripts/test.sh"
12- eval $CMD
13- RESULT=$?
14- if [ $RESULT -ne 0 ]; then
13+ if ! " $CMD " ; then
1514 echo " The git push operation was canceled because \` $CMD \` did not complete successfully."
1615 exit 1
1716fi
You can’t perform that action at this time.
0 commit comments