From ea24921efface574f6f668548151611e99709f0d Mon Sep 17 00:00:00 2001 From: Adam Wright Date: Sun, 10 Jan 2016 17:48:47 -0800 Subject: [PATCH] Just go to a simple world where we check the branch we're on --- hooks/pre-push | 48 +++++++----------------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/hooks/pre-push b/hooks/pre-push index ff229ca..be9282c 100755 --- a/hooks/pre-push +++ b/hooks/pre-push @@ -1,30 +1,9 @@ #!/bin/sh -# An example hook script to verify what is about to be pushed. Called by "git -# push" after it has checked the remote status, but before anything has been -# pushed. If this script exits with a non-zero status nothing will be pushed. -# -# This hook is called with the following parameters: -# -# $1 -- Name of the remote to which the push is being done -# $2 -- URL to which the push is being done -# -# If pushing without using a named remote those arguments will be equal. -# -# Information about the commits which are being pushed is supplied as lines to -# the standard input in the form: -# -# -# -# This sample shows how to prevent push of commits where the log message starts -# with "WIP" (work in progress). - RED='\033[0;31m' GREEN='\033[0;32m' NC='\033[0m' # No Color -echo Running pre-push test check - BRANCH=$(git symbolic-ref HEAD 2>/dev/null) BRANCH_RESULT=$? BRANCH=${BRANCH#refs/heads/} @@ -41,29 +20,16 @@ then exit 1 fi -TEST_RESULT=0 -while read local_ref local_sha remote_ref remote_sha -do - git checkout $local_ref &>/dev/null - CURRENT_BRANCH=${local_ref#refs/heads/} - - cargo test &>/dev/null - CARGO_RESULT=$? - if [ "$CARGO_RESULT" != "0" ]; - then - echo ${RED}FAIL${NC} $CURRENT_BRANCH - TEST_RESULT=1 - else - echo ${GREEN}PASS${NC} $CURRENT_BRANCH - fi -done - -git checkout ${BRANCH} &>/dev/null +cargo test &>/dev/null +if [ "$?" != "0" ]; +then + echo ${GREEN}FAIL${NC} pre-push test check +else + echo ${GREEN}PASS${NC} pre-push test check +fi if [ "$TEST_RESULT" == "1" ]; then exit 1 fi - -echo Pre-push check complete. exit 0