Skip to content

Commit

Permalink
prepare-commit.sh: when run as pre-commit hook use /dev/tty. And don't
Browse files Browse the repository at this point in the history
generally complain about trailing whitespaces as we have cases where
that's fine (and hence are excluded from astyle).
  • Loading branch information
jef-n committed Aug 6, 2017
1 parent 4e9dda2 commit 177a017
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/prepare-commit.sh
Expand Up @@ -18,6 +18,10 @@ TOPLEVEL=$(git rev-parse --show-toplevel)

PATH=$TOPLEVEL/scripts:$PATH

if ! tty -s && [[ "$0" =~ /pre-commit ]]; then
exec </dev/tty
fi

cd $TOPLEVEL

# GNU prefix command for mac os support (gsed, gsplit)
Expand Down Expand Up @@ -142,9 +146,6 @@ if [ -s "$ASTYLEDIFF" ]; then
exit 1
fi

# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached HEAD --

exit 0

# vim: set ts=2 expandtab :

0 comments on commit 177a017

Please sign in to comment.