summaryrefslogtreecommitdiff
path: root/pre-commit.d/10store-metadata
blob: 79588887282eeb5689785c66e7d7eea08d0406d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
set -e

# 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