From 2a8a33d28267f84e947834c1374a5e413f6d760e Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Thu, 1 May 2025 23:10:56 -0700 Subject: Experiment with hooks. --- .../roles/src/templates/volumes/data/hooks/update | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 playbooks/roles/src/templates/volumes/data/hooks/update (limited to 'playbooks/roles/src/templates/volumes/data/hooks/update') diff --git a/playbooks/roles/src/templates/volumes/data/hooks/update b/playbooks/roles/src/templates/volumes/data/hooks/update new file mode 100755 index 0000000..a11d3e5 --- /dev/null +++ b/playbooks/roles/src/templates/volumes/data/hooks/update @@ -0,0 +1,37 @@ +#!/bin/sh +# + +refname="$1" +oldrev="$2" +newrev="$3" + +# Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero=$(git hash-object --stdin