Source for serving and static templating/compiling of https://joshstock.in.
| {#} | Time | Hash | Subject | Author | # | (+) | (-) | GPG? |
|---|---|---|---|---|---|---|---|---|
| 44 | 04 Jan 2020 12:27 | b0911fd | Update permission for git hooks | Josh Stockin | 1 | 6 | 12 | N |
| 1 | #!/bin/bash |
| 2 | |
| 3 | # .git/hooks/pre-receive |
| 4 | |
| 5 | SCRIPTPATH=$(dirname $(realpath -s $0)) |
| 6 | |
| 7 | while read oldrev newrev ref |
| 8 | do |
| 9 | echo "Ref $ref received. Checking for post-receive hook modification..." |
| 10 | if [ ! git diff --name-only $1..$2 | grep 'post-receive' ]; then |
| 11 | echo "Updated post-receive hook detected. Installing..." |
| 12 | git archive $newrev | tar -x -C /tmp/newrev |
| 13 | cp /tmp/newrev/post-receive $SCRIPTPATH/post-receive |
| 14 | rm -rf /tmp/newrev |
| 15 | fi |
| 16 | done |
| 17 |