summaryrefslogtreecommitdiff
path: root/pre-commit.d/20warn-problem-files
blob: d600ff69ff63d46d1ac312739b904c5da7e12dec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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" ]; then
	echo "etckeeper warning: special files could cause problems with $VCS:" >&2
	echo "$special" >&2
fi
if [ -n "$hardlinks" ]; then
	echo "etckeeper warning: hardlinked files could cause problems with $VCS:" >&2
	echo "$hardlinks" >&2
fi

true