[Cryptech-Commits] [wiki] branch production updated: Document the git hook

git at cryptech.is git at cryptech.is
Sat Oct 9 13:37:29 UTC 2021


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch production
in repository wiki.

The following commit(s) were added to refs/heads/production by this push:
     new 1b45469  Document the git hook
1b45469 is described below

commit 1b45469da6237f8f4604f463f559cdee1812ad2c
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sat Oct 9 09:37:08 2021 -0400

    Document the git hook
---
 README.md | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/README.md b/README.md
index 9b29ee6..c353b1b 100644
--- a/README.md
+++ b/README.md
@@ -34,3 +34,38 @@ won't cause compilation to fail, so don't do that. :)
 
 As with all Cryptech git repositories, all commits to this repository
 must be signed by a known key.
+
+For completeness, here's how this hooks into git: hang something like
+the following script off the upstream repository's `update` hook:
+
+```
+#!/bin/sh -
+
+set -xe
+
+ref="$1"
+oldrev="$2"
+newrev="$3"
+
+branch=refs/heads/production
+repo=/some/where/safe.git
+work=/some/where/else
+dest=/some/where/visible
+
+if test "$ref" = "$branch"
+then
+    export CRYPTECH_WIKI_PRODUCTION_BUILD=true
+    cd $work
+    git --git-dir $repo --work-tree $work checkout --force $newrev
+    git --git-dir $repo --work-tree $work submodule update --init
+    pelican --output website --settings pelicanconf.py --fatal errors content
+    chmod -R a+rX $work
+    rsync -a --delete website/ $dest/
+fi
+```
+
+Setting `--git-dir` is *probably* unnecessary, since the hook will
+inherit the `$GIT_DIR` environment variable, but it's also harmless.
+`$CRYPTECH_WIKI_PRODUCTION_BUILD` allows our `pelicanconf.py` to
+default to developer settings while automatically using production
+settings when built using the git hook.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list