From 06a2cab31c6b82278ab06587bda04bf5b2bfdd18 Mon Sep 17 00:00:00 2001 From: Adam Wright Date: Fri, 19 Feb 2016 23:08:50 -0800 Subject: [PATCH] Move /bin/bash to the top so it works --- hooks/pre-commit | 11 ++++------- hooks/pre-push | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/hooks/pre-commit b/hooks/pre-commit index ae144b9..3960d13 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -1,9 +1,10 @@ +#!/bin/bash + # Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the MIT License, . # This file may not be copied, modified, or distributed except according to those terms. -#!/bin/sh # # Pre-commit hook for the tarpc repository. To use this hook, copy it to .git/hooks in your # repository root. @@ -34,7 +35,7 @@ WARNING="${RED}[WARNING]${NC}" SKIPPED="${YELLOW}SKIPPED${NC}" SUCCESS="${GREEN}ok${NC}" -if git rev-parse --verify HEAD >/dev/null 2>&1 +if git rev-parse --verify HEAD &>/dev/null then against=HEAD else @@ -42,17 +43,13 @@ else against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi -# Redirect output to stderr. -exec 1>&2 - FAILED=0 printf "${PREFIX} Checking that all filenames are ascii ... " # Note that the use of brackets around a tr range is ok here, (it's # even required, for portability to Solaris 10's /usr/bin/tr), since # the square bracket bytes happen to fall in the designated range. -if test $(git diff --cached --name-only --diff-filter=A -z $against | - LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +if test $(git diff --cached --name-only --diff-filter=A -z $against | LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 then FAILED=1 printf "${FAILURE}\n" diff --git a/hooks/pre-push b/hooks/pre-push index a488ea8..2a63b79 100755 --- a/hooks/pre-push +++ b/hooks/pre-push @@ -1,3 +1,5 @@ +#!/bin/bash + # Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the MIT License, . @@ -26,8 +28,6 @@ # Note that these options are most useful for testing the hooks themselves. Use git push --no-verify # to skip the pre-push hook altogether. -#!/bin/sh - RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[0;33m'