File: 20warn-problem-files

package info (click to toggle)
etckeeper 1.18.23-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,640 kB
  • sloc: sh: 1,267; python: 111; makefile: 109; ansic: 81
file content (30 lines) | stat: -rwxr-xr-x 1,138 bytes parent folder | download | duplicates (3)
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 () {
	grep -E -v '(^|/)(\.git|\.hg|\.bzr|_darcs)/'
}

if [ "$VCS" = bzr ] || [ "$VCS" = darcs ]; then
	special=$(find . ! -type d ! -type f ! -type l | exclude_internal) || true
	hardlinks=$(find . -type f ! -links 1 | exclude_internal ) || true
elif [ "$VCS" = hg ]; then
	special=$(find . ! -type d ! -type f ! -type l | exclude_internal) || true
	hardlinks=$(find . -type f ! -links 1 -exec hg status {} \; | exclude_internal ) || true
elif [ "$VCS" = git ]; then
	special=$(find . ! -type d ! -type f ! -type l -exec git ls-files --exclude-standard --cached --others {} + | exclude_internal) || true
	hardlinks=$(find . -type f ! -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