summaryrefslogtreecommitdiff
path: root/examples/pre-commit
blob: b91635d646d63d13ae834d15026c95fe6e074ec4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
#
# An example hook script to store metadata information using
# metastore on each commit.

MSFILE=".metadata"

exit_on_fail() {
	"$@"
	if [ $? -ne 0 ]; then
		echo "Failed to execute: $@" >&2
		exit 1
	fi
}

exit_on_fail \
	metastore -s -f "$MSFILE"

if [ ! -e "$MSFILE" ]; then
	echo "\"$MSFILE\" missing" >&2
	exit 1
fi

exit_on_fail \
	git-add "$MSFILE"

exit 0