aboutsummaryrefslogtreecommitdiff
path: root/src/infrastructure/ci/git-pre-receive.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-11 08:53:30 -0300
committerEuAndreh <eu@euandre.org>2023-03-11 19:36:12 -0300
commit786d6958a5733b28ec089685df7c0eac980c5f2a (patch)
tree9afb19eda6db66f68f5a914aa4fa38fde8b0d9b5 /src/infrastructure/ci/git-pre-receive.sh
parentchannels.scm: Remove "nonguix" channel (diff)
downloadserver-786d6958a5733b28ec089685df7c0eac980c5f2a.tar.gz
server-786d6958a5733b28ec089685df7c0eac980c5f2a.tar.xz
Copy files back
Diffstat (limited to 'src/infrastructure/ci/git-pre-receive.sh')
-rwxr-xr-xsrc/infrastructure/ci/git-pre-receive.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/infrastructure/ci/git-pre-receive.sh b/src/infrastructure/ci/git-pre-receive.sh
new file mode 100755
index 0000000..8cd83ee
--- /dev/null
+++ b/src/infrastructure/ci/git-pre-receive.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+set -eu
+
+read -r _oldrev SHA _refname
+unset GIT_DIR
+
+if [ "$SHA" = '0000000000000000000000000000000000000000' ]; then
+ exit
+fi
+
+printf 'Upgrading post-receive hook...' >&2
+git show "$SHA":src/infrastructure/ci/git-post-receive.sh > hooks/post-receive
+chmod +x hooks/post-receive
+printf 'done.\n' >&2