fix display of message in usage message
[metastore.git] / examples / pre-commit
blobe0e89ddb596176007b9c4a5760df2b192a6cc85f
1 #!/bin/bash
3 # An example hook script to store metadata information using
4 # metastore on each commit. A verification message with a list
5 # of changes will first be shown and only if it is accepted will
6 # the commit proceed.
8 echo "Going to commit the following metadata changes" >&2
9 metastore -c -m >&2
10 echo -n "Ok to commit? (y/n): " >&2
11 read -n1 REPLY
12 echo ""
14 if [ "$REPLY" != "y" ]; then
15 echo "Aborted" >&2
16 exit 1
19 if ! metastore -s; then
20 echo "Failed to execute metastore -s" >&2
21 exit 1
24 if [ ! -e ".metadata" ]; then
25 echo ".metadata missing" >&2
26 exit 1
29 if ! git-add .metadata; then
30 echo "Failed to execute git-add .metadata" >&2
31 exit 1
34 exit 0