summaryrefslogtreecommitdiff
path: root/pre-commit.d/20warn-problem-files
diff options
context:
space:
mode:
authorJoey Hess <joeyh@debian.org>2013-07-31 11:33:45 -0400
committerJoey Hess <joeyh@debian.org>2013-07-31 11:33:45 -0400
commitfdeec420b54e252e611c353ce39fe61c924e3e7d (patch)
tree2a1974e6c8cc56263e3903f49ea2a841ea895c6d /pre-commit.d/20warn-problem-files
etckeeper (1.7) unstable; urgency=low
* Fix hilarious typo hardcoding my name. Closes: #718425 # imported from the archive
Diffstat (limited to 'pre-commit.d/20warn-problem-files')
-rwxr-xr-xpre-commit.d/20warn-problem-files30
1 files changed, 30 insertions, 0 deletions
diff --git a/pre-commit.d/20warn-problem-files b/pre-commit.d/20warn-problem-files
new file mode 100755
index 0000000..f7c7580
--- /dev/null
+++ b/pre-commit.d/20warn-problem-files
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+
+exclude_internal () {
+ egrep -v '(^|/)(.git|.hg|.bzr|_darcs)/'
+}
+
+if [ "$VCS" = bzr ] || [ "$VCS" = darcs ]; then
+ special=$(find . -not -type d -not -type f -not -type l | exclude_internal) || true
+ hardlinks=$(find . -type f -not -links 1 | exclude_internal ) || true
+elif [ "$VCS" = hg ]; then
+ special=$(find . -not -type d -not -type f -not -type l | exclude_internal) || true
+ hardlinks=$(find . -type f -not -links 1 -exec hg status {} \; | exclude_internal ) || true
+elif [ "$VCS" = git ]; then
+ special=$(find . -not -type d -not -type f -not -type l -exec git ls-files --exclude-standard --cached --others {} \; | exclude_internal) || true
+ hardlinks=$(find . -type f -not -links 1 -exec git ls-files --exclude-standard --cached --others {} \; | exclude_internal) || true
+else
+ special=""
+fi
+
+if [ -n "$special" ] && [ -z "$AVOID_SPECIAL_FILE_WARNING" ]; then
+ echo "etckeeper warning: special files could cause problems with $VCS:" >&2
+ echo "$special" >&2
+fi
+if [ -n "$hardlinks" ] && [ -z "$AVOID_SPECIAL_FILE_WARNING" ]; then
+ echo "etckeeper warning: hardlinked files could cause problems with $VCS:" >&2
+ echo "$hardlinks" >&2
+fi
+
+true