chiark / gitweb /
Some stuff. And a README
authorJonathan Amery <jdamery+zgit@ysolde.ucam.org>
Mon, 29 Sep 2014 13:42:37 +0000 (14:42 +0100)
committerJonathan Amery <jdamery+zgit@ysolde.ucam.org>
Mon, 29 Sep 2014 13:42:37 +0000 (14:42 +0100)
git/README.txt [new file with mode: 0644]
git/new-git.sh [new file with mode: 0755]
git/post-update [new file with mode: 0755]
git/post-update-2chiark [new file with mode: 0755]

diff --git a/git/README.txt b/git/README.txt
new file mode 100644 (file)
index 0000000..86691d1
--- /dev/null
@@ -0,0 +1,9 @@
+Three small bits:
+
+. new-git.sh - makes a bare repo on chiark, clones it, and pushes an
+              initial empty commit to it so that git push works as
+              expected.
+
+. post-update - a post-update hook that runs other post-update hooks
+
+. post-update-2chiark - a post-update hook that pushes to another repo
diff --git a/git/new-git.sh b/git/new-git.sh
new file mode 100755 (executable)
index 0000000..74001fc
--- /dev/null
@@ -0,0 +1,15 @@
+#! /bin/sh
+set -e
+
+name="$1"
+shift
+
+ssh chiark "mkdir scm/$name; cd scm/$name; git init --bare"
+
+git clone "chiark:scm/$name"
+
+cd "$name"
+
+git commit --allow-empty -m Initial
+
+git push origin master
diff --git a/git/post-update b/git/post-update
new file mode 100755 (executable)
index 0000000..b8abcdd
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# Runs all executable pre-commit-* hooks and exits after,
+# if any of them was not successful.
+#
+# Based on
+# http://osdir.com/ml/git/2009-01/msg00308.html
+#
+# Modified by JDA to log to syslog
+
+data=$(cat)
+exitcodes=()
+hookname=`basename $0`
+
+# Run each hook, passing through STDIN and storing the exit code.
+# We don't want to bail at the first failure, as the user might
+# then bypass the hooks without knowing about additional issues.
+
+for hook in $GIT_DIR/hooks/$hookname-*; do
+  test -x "$hook" || continue
+  echo "$data" | "$hook" 2>&1 | logger -p local5.notice -t ArtibusWiki
+  exitcodes+=($?)
+done
+
+# If any exit code isn't 0, bail.
+
+for i in "${exitcodes[@]}"; do
+  [ "$i" == 0 ] || exit $i
+done
diff --git a/git/post-update-2chiark b/git/post-update-2chiark
new file mode 100755 (executable)
index 0000000..4e2c773
--- /dev/null
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+git push chiark-scm || true