summaryrefslogtreecommitdiff
path: root/pre-commit.d/10store-metadata
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 /pre-commit.d/10store-metadata
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..
Diffstat (limited to 'pre-commit.d/10store-metadata')
-rwxr-xr-xpre-commit.d/10store-metadata16
1 files changed, 14 insertions, 2 deletions
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