New pages from giskard
[wiki.git] / post_edit_hook.sh
diff --git a/post_edit_hook.sh b/post_edit_hook.sh
new file mode 100644 (file)
index 0000000..d12d0a7
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Die easily and make sure the cgi collects stderr too
+set -e
+exec 2>&1
+
+if [ $# -ne 3 ]; then
+       echo "Usage $0 <path-to-commit> <remote-user> <remote-host>"
+       exit 1
+fi
+
+repo=`dirname "$1"`
+file=`basename "$1"`
+
+cd $repo
+git-add $file # In case it's a new page
+
+GIT_COMMITTER_NAME='Piki Plus' \
+GIT_COMMITTER_EMAIL='webmaster@codewiz.org' \
+git-commit -a -m "Edit page $file" --author="$2 <$2@$3>"