summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinit.d/10restore-etckeeper2
-rwxr-xr-xinit.d/20restore-metadata2
-rwxr-xr-xpre-commit.d/20store-empty-directory5
-rwxr-xr-xpre-commit.d/30store-metadata5
4 files changed, 10 insertions, 4 deletions
diff --git a/init.d/10restore-etckeeper b/init.d/10restore-etckeeper
index 376524c..f49e70c 100755
--- a/init.d/10restore-etckeeper
+++ b/init.d/10restore-etckeeper
@@ -5,4 +5,6 @@ set -e
# should only be run on repositories you trust.
if [ -e .etckeeper ]; then
. ./.etckeeper
+else
+ touch .etckeeper
fi
diff --git a/init.d/20restore-metadata b/init.d/20restore-metadata
index 01c45e4..5d76b1b 100755
--- a/init.d/20restore-metadata
+++ b/init.d/20restore-metadata
@@ -7,4 +7,6 @@ set -e
# should only be run on repositories you trust.
if [ -e .metadata ]; then
metastore --apply --mtime
+else
+ metastore --save
fi
diff --git a/pre-commit.d/20store-empty-directory b/pre-commit.d/20store-empty-directory
index 0cab9df..a52a383 100755
--- a/pre-commit.d/20store-empty-directory
+++ b/pre-commit.d/20store-empty-directory
@@ -16,11 +16,12 @@ if [ "$VCS" = git ] || [ "$VCS" = hg ]; then
if [ ! -e .etckeeper ] || ! cmp -s .etckeeper .etckeeper.new ; then
mv -f .etckeeper.new .etckeeper
+ # stage the file as part of the current commit
if [ "$VCS" = git ]; then
git add .etckeeper
- elif [ "$VCS" = hg ]; then
- hg add .etckeeper
fi
+ # hg add not done, hg will automatically include the file
+ # in the current commit
else
rm -f .etckeeper.new
fi
diff --git a/pre-commit.d/30store-metadata b/pre-commit.d/30store-metadata
index 959e714..19b4673 100755
--- a/pre-commit.d/30store-metadata
+++ b/pre-commit.d/30store-metadata
@@ -16,10 +16,11 @@ if [ "$VCS" = git ] || [ "$VCS" = hg ]; then
if [ ! -z "$(metastore --compare)" ]; then
metastore --save
+ # stage the file as part of the current commit
if [ "$VCS" = git ]; then
git add .metadata
- elif [ "$VCS" = hg ]; then
- hg add .metadata
fi
+ # hg add not done, hg will automatically include the file
+ # in the current commit
fi
fi