summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2014-11-25 23:12:46 +0100
committerPrzemyslaw Pawelczyk <przemoc@gmail.com>2015-09-02 23:20:51 +0200
commit8f5d8324bdc3180dd5af48070a7eeead40fb224c (patch)
tree6b6209ab593997220bf560491120de6c2792f4d3 /examples
parent05344dae94950f268c13bad63fcf5e038b95696b (diff)
examples: Add post-checkout example script.
This is analagous script to the pre-commit one, but it applies metadata automatically after a git checkout. Signed-off-by: Przemyslaw Pawelczyk <przemoc@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/post-checkout24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/post-checkout b/examples/post-checkout
new file mode 100644
index 0000000..bd4de15
--- /dev/null
+++ b/examples/post-checkout
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# An example hook script to set metadata information using
+# metastore after each checkout.
+
+MSFILE=".metadata"
+
+exit_on_fail() {
+ "$@"
+ if [ $? -ne 0 ]; then
+ echo "Failed to execute: $@" >&2
+ exit 1
+ fi
+}
+
+if [ ! -e "$MSFILE" ]; then
+ echo "\"$MSFILE\" missing" >&2
+ exit 1
+fi
+
+exit_on_fail \
+ metastore -a -m -e -E -q -f "$MSFILE"
+
+exit 0