summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2007-11-05 18:02:20 -0500
committerJoey Hess <joey@kodama.kitenet.net>2007-11-05 18:02:20 -0500
commite737d1795d0acbaba09412b3b969b33fc8956b85 (patch)
treed134601e7ca98dafdab3cf077fbfc6c113e675fb
parentf0522c931958b7dccca733229254f2e37f0ef20c (diff)
metastore fun
work around various bugs and issues to avoid each commit making a change that would be seen by the next commit..
-rw-r--r--README6
-rwxr-xr-xinit.d/10restore-metadata2
-rwxr-xr-xpre-commit.d/10store-metadata16
3 files changed, 18 insertions, 6 deletions
diff --git a/README b/README
index 2751eb7..967ffea 100644
--- a/README
+++ b/README
@@ -41,9 +41,9 @@ git has only limited tracking of file metadata, being able to track the
executable bit, but not other permissions or owner info. So file metadata
storage is handled by `metastore`. Amoung other chores, `etckeeper-init`
sets up a git hook that use `metastore` to store metadata about file
-owners, permissions, modification times, and even extended attributes. This
-metadata is stored in git along with everything else, and can be applied if
-the repo should need to be checked back out.
+owners, permissions, and even extended attributes. This metadata is stored
+in git along with everything else, and can be applied if the repo should
+need to be checked back out.
git cannot track empty directories. So `etckeeper-init` also sets up a git
hook to run `etckeeper-pre-commit`, which checks for empty directories
diff --git a/init.d/10restore-metadata b/init.d/10restore-metadata
index 4ce97ed..fdb1f8e 100755
--- a/init.d/10restore-metadata
+++ b/init.d/10restore-metadata
@@ -1,5 +1,5 @@
#!/bin/sh
set -e
if [ -e .metadata ]; then
- metastore --apply --mtime
+ metastore --apply
fi
diff --git a/pre-commit.d/10store-metadata b/pre-commit.d/10store-metadata
index 322a3ae..7958888 100755
--- a/pre-commit.d/10store-metadata
+++ b/pre-commit.d/10store-metadata
@@ -1,4 +1,16 @@
#!/bin/sh
set -e
-metastore --save --mtime
-git add .metadata
+
+# ensure the file exists so that it will list its own metadata
+if [ ! -e .metadata ]; then
+ metastore --save
+ # the file could leak hidden dir contents..
+ chmod 600 .metadata
+fi
+
+# metastore doesn't produce the same output file for the same metadata
+# everytime, so avoid changing the file if nothing really changed.
+if [ ! -z "$(metastore --compare)" ]; then
+ metastore --save
+ git add .metadata
+fi