summaryrefslogtreecommitdiff
path: root/examples/hooks/pre-commit
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hooks/pre-commit')
-rw-r--r--examples/hooks/pre-commit6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/hooks/pre-commit b/examples/hooks/pre-commit
index de66e3e..dc79432 100644
--- a/examples/hooks/pre-commit
+++ b/examples/hooks/pre-commit
@@ -27,6 +27,12 @@ exit_on_fail() {
exit_on_fail \
metastore -s -f "$MSFILE"
+# If it's first metastore commit, store again to include $MSFILE in $MSFILE.
+if ! git-ls-tree --name-only HEAD 2>/dev/null | grep -Fqx "$MSFILE"; then
+ exit_on_fail \
+ metastore -s -f "$MSFILE"
+fi
+
if [ ! -e "$MSFILE" ]; then
echo "\"$MSFILE\" missing" >&2
exit 1