if test $backup = 1; then
hooks=$(cd scripts/git-hooks && git ls-files)
for f in $hooks; do
- # If it is identical, skip it.
- cmp scripts/git-hooks/$f .git/hooks/$f > /dev/null \
- && continue
+ if [ -f .git/hooks/$f ]; then
+ # If it is identical, skip it.
+ cmp scripts/git-hooks/$f .git/hooks/$f > /dev/null \
+ && continue
+ fi
cp --backup=numbered scripts/git-hooks/$f .git/hooks
chmod a-w .git/hooks/$f
done