1122c5
diff --git a/pre-commit.d/20warn-problem-files b/pre-commit.d/20warn-problem-files
1122c5
index 6bd5c2b..7899268 100755
1122c5
--- a/pre-commit.d/20warn-problem-files
1122c5
+++ b/pre-commit.d/20warn-problem-files
1122c5
@@ -1,19 +1,20 @@
1122c5
 #!/bin/sh
1122c5
 set -e
1122c5
 
1122c5
-exclude_internal () {
1122c5
-	egrep -v '(^|/)(\.git|\.hg|\.bzr|_darcs)/'
1122c5
-}
1122c5
+# (Note that when using this, the find expression must end with
1122c5
+# -print or -exec, else the excluded directories will actually be
1122c5
+# printed!)
1122c5
+NOVCS='. -path ./.git -prune -o -path ./.bzr -prune -o -path ./.hg -prune -o -path ./_darcs -prune -o'
1122c5
 
1122c5
 if [ "$VCS" = bzr ] || [ "$VCS" = darcs ]; then
1122c5
-	special=$(find . ! -type d ! -type f ! -type l | exclude_internal) || true
1122c5
-	hardlinks=$(find . -type f ! -links 1 | exclude_internal ) || true
1122c5
+	special=$(find $NOVCS ! -type d ! -type f ! -type l -print) || true
1122c5
+	hardlinks=$(find $NOVCS -type f ! -links 1 -print) || true
1122c5
 elif [ "$VCS" = hg ]; then
1122c5
-	special=$(find . ! -type d ! -type f ! -type l | exclude_internal) || true
1122c5
-	hardlinks=$(find . -type f ! -links 1 -exec hg status {} \; | exclude_internal ) || true
1122c5
+	special=$(find $NOVCS ! -type d ! -type f ! -type l -print) || true
1122c5
+	hardlinks=$(find $NOVCS -type f ! -links 1 -exec hg status {} \; -print) || true
1122c5
 elif [ "$VCS" = git ]; then
1122c5
-	special=$(find . ! -type d ! -type f ! -type l -exec git ls-files --exclude-standard --cached --others {} + | exclude_internal) || true
1122c5
-	hardlinks=$(find . -type f ! -links 1 -exec git ls-files --exclude-standard --cached --others {} + | exclude_internal) || true
1122c5
+	special=$(find $NOVCS ! -type d ! -type f ! -type l -exec git ls-files --exclude-standard --cached --others {} + -print) || true
1122c5
+	hardlinks=$(find $NOVCS -type f ! -links 1 -exec git ls-files --exclude-standard --cached --others {} + -print) || true
1122c5
 else
1122c5
 	special=""
1122c5
 fi