diff options
author | Przemyslaw Pawelczyk <przemoc@gmail.com> | 2016-01-19 23:32:49 +0100 |
---|---|---|
committer | Przemyslaw Pawelczyk <przemoc@gmail.com> | 2016-01-19 23:32:49 +0100 |
commit | 95921e7ad884f4b7c19ce6f716e452f41dbf18c9 (patch) | |
tree | 64216478851185edeba1f91d8095b982f61aff0d /examples | |
parent | 10f95bf8b1eb81ae8730487db2c9c53139481a17 (diff) |
examples/hooks/pre-commit: Improve handling of first metastore commit.
Previously after first metastore commit, metastore -c would show
./.metadata: added
which was misleading.
Now metastore -s is run twice if .metadata is not in repository yet.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/hooks/pre-commit | 6 |
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 |