Skip to content

Commit

Permalink
examples/hooks/pre-commit: Improve handling of first metastore commit.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
przemoc committed Jan 19, 2016
1 parent 10f95bf commit 95921e7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 95921e7

Please sign in to comment.