Index

joshstock.in / aa33696

Source for serving and static templating/compiling of https://joshstock.in.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
13013 Oct 2021 20:406203cefUpdate pre-receiveJosh Stockin1014G

Blob @ joshstock.in / pre-receive

text/x-shellscript575 bytesdownload raw
1#!/bin/bash
2
3# .git/hooks/pre-receive
4
5SCRIPTPATH=$(dirname $(realpath -s $0))
6
7while read oldrev newrev ref
8do
9 echo "Ref $ref received. Checking for post-receive hook modification..."
10 if [[ $(! git diff --name-only $oldrev $newrev | grep post-receive) ]]; then
11 echo "Updated post-receive hook detected. Installing..."
12 mkdir -p /tmp/newrev
13 git archive $newrev | tar -x -C /tmp/newrev
14 mv /tmp/newrev/post-receive $SCRIPTPATH/post-receive
15 rm -rf /tmp/newrev
16 else
17 echo "No post-receive hook modification."
18 fi
19done
20