summaryrefslogtreecommitdiff
path: root/examples/post-checkout
diff options
context:
space:
mode:
Diffstat (limited to 'examples/post-checkout')
-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