Skip to content

Commit 9929604

Browse files
authored
pre-commit hook to check for KJ_DBG in source files (#1060)
1 parent 7d83042 commit 9929604

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

githooks/pre-commit

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
cd "$(git rev-parse --show-toplevel)"
4+
DISALLOWED_PATTERN='KJ_DBG'
5+
6+
if git diff-index -G"$DISALLOWED_PATTERN" --cached HEAD --diff-filter=AM -U0 | grep -i --color -E "$DISALLOWED_PATTERN"
7+
then
8+
echo -e "\nERROR, KJ_DBG is not allowed in checked-in source code:"
9+
echo -e " see https://github.com/capnproto/capnproto/blob/v2/c%2B%2B/src/kj/debug.h#L42\n"
10+
echo -e "To commit anyway, use --no-verify\n"
11+
exit 1
12+
fi

0 commit comments

Comments
 (0)