diff options
author | David Härdeman <david@hardeman.nu> | 2007-05-20 12:17:19 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2007-05-20 12:17:19 +0200 |
commit | 677423cf4c24c193cd5e4d8cadc61978b07ed6da (patch) | |
tree | 2f3d9a3ae146791d7bdc8b2c0cbb3c95b41446f0 /examples/pre-commit | |
parent | a53129d4b7a60b1fc29173accb5da5b74d2d16ba (diff) |
Add example scripts to integrate metastore with git
Diffstat (limited to 'examples/pre-commit')
-rw-r--r-- | examples/pre-commit | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/pre-commit b/examples/pre-commit new file mode 100644 index 0000000..e0e89dd --- /dev/null +++ b/examples/pre-commit @@ -0,0 +1,34 @@ +#!/bin/bash +# +# An example hook script to store metadata information using +# metastore on each commit. A verification message with a list +# of changes will first be shown and only if it is accepted will +# the commit proceed. + +echo "Going to commit the following metadata changes" >&2 +metastore -c -m >&2 +echo -n "Ok to commit? (y/n): " >&2 +read -n1 REPLY +echo "" + +if [ "$REPLY" != "y" ]; then + echo "Aborted" >&2 + exit 1 +fi + +if ! metastore -s; then + echo "Failed to execute metastore -s" >&2 + exit 1 +fi + +if [ ! -e ".metadata" ]; then + echo ".metadata missing" >&2 + exit 1 +fi + +if ! git-add .metadata; then + echo "Failed to execute git-add .metadata" >&2 + exit 1 +fi + +exit 0 |