home · contact · privacy
Fix pandoc email obfuscation default.
[redo-blog] / README.md
index 822c08d594be5e0cc29b3e07acc2a3cdba68a2c4..12d7372247c8cbd88117be6399e1be9dbffb05e2 100644 (file)
--- a/README.md
+++ b/README.md
@@ -49,10 +49,22 @@ called `blog`:
     git init --bare blog.git
     cat << EOF > blog.git/hooks/post-update
     #!/bin/sh
-    BLOGDIR=~/blog
-    GIT_WORK_TREE=\$BLOGDIR git checkout -f
-    cd \$BLOGDIR
+    blog_dir=~/blog
+    export GIT_DIR=\$(pwd)
+    export GIT_WORK_TREE="\$blog_dir"
+    git checkout -f
+    cd "\$GIT_WORK_TREE"
     redo
+    git add metadata/author metadata/url metadata/title metadata/*.tmpl metadata/automatic_metadata
+    count=\$(ls -1 metadata/*.automatic_metadata 2>/dev/null | wc -l)
+    if [ "\$count" != 0 ]; then
+      git add metadata/*.automatic_metadata
+    fi
+    status=\$(git status -s)
+    n_updates=\$(printf "\$status" | grep -vE '^\?\?' | wc -l)
+    if [ "\$n_updates" -gt 0 ]; then
+      git commit -a -m 'Update metadata'
+    fi
     EOF
     chmod a+x blog.git/hooks/post-update
 
@@ -81,6 +93,11 @@ replace the username `user` and the server name `example.org`):
     git commit -m 'set up blog metadata'
     git push origin master
 
+If successful, the git hook will furthermore commit some ~/blog/metadata/ files
+generated by redo, that can be pulled into the client-side local repository:
+
+    git pull origin master
+
 bugs and peculiarities
 ----------------------
 
@@ -90,5 +107,4 @@ break things.
 The article title is derived in .md files from a first line prefixed with `%`,
 while all other headings are treated as sub-headings. In .rst files, the title
 is derived from a heading that must be at the top of the document, and be of an
-adornment style (such as underlining with `=`) that must be used only once in
-it.
+adornment style (such as underlining with `=`) used only once in it.