summaryrefslogtreecommitdiff
path: root/pre-commit.d
diff options
context:
space:
mode:
Diffstat (limited to 'pre-commit.d')
-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