[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] scripts: check files exist before comparing
From: |
Sami Kerola |
Subject: |
[PATCH 2/3] scripts: check files exist before comparing |
Date: |
Sun, 28 Dec 2014 11:27:24 +0000 |
* bootstrap.conf: Add if clause before cmp(1) call.
---
bootstrap.conf | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 4e0b388..072e74d 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -109,9 +109,11 @@ bootstrap_epilogue()
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
--
2.2.1