Skip to content

Commit 177a017

Browse files
committedAug 6, 2017
prepare-commit.sh: when run as pre-commit hook use /dev/tty. And don't
generally complain about trailing whitespaces as we have cases where that's fine (and hence are excluded from astyle).
1 parent 4e9dda2 commit 177a017

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎scripts/prepare-commit.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ TOPLEVEL=$(git rev-parse --show-toplevel)
1818

1919
PATH=$TOPLEVEL/scripts:$PATH
2020

21+
if ! tty -s && [[ "$0" =~ /pre-commit ]]; then
22+
exec </dev/tty
23+
fi
24+
2125
cd $TOPLEVEL
2226

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

145-
# If there are whitespace errors, print the offending file names and fail.
146-
exec git diff-index --check --cached HEAD --
147-
148149
exit 0
149150

150151
# vim: set ts=2 expandtab :

0 commit comments

Comments
 (0)
Please sign in to comment.