summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Spragg <adam@spra.gg>2022-05-24 09:51:55 +0100
committerAdam Spragg <adam@spra.gg>2022-05-24 10:12:33 +0100
commit8a77b1abdbee3566eb550855f2162dec3126adc8 (patch)
tree1ceb9eb12a7a3512a847ae49374bc48b51725943
parent7e80a15a8ce294d99ad015e672a85727ede76b15 (diff)
Add post-merge git hook.
It's the same as the post-checkout hook, doing the same job. I thought about symlinking instead of copying, but something doesn't sit quite right about that.
-rwxr-xr-xexamples/hooks/post-merge24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/hooks/post-merge b/examples/hooks/post-merge
new file mode 100755
index 0000000..938305f
--- /dev/null
+++ b/examples/hooks/post-merge
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# An example hook script to set metadata information using
+# metastore after a successful merge
+
+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