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