From 8f5d8324bdc3180dd5af48070a7eeead40fb224c Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Tue, 25 Nov 2014 23:12:46 +0100 Subject: 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 --- examples/post-checkout | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 examples/post-checkout 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 -- cgit v1.2.1