Add some weak docs and samples for server-side hook install.
authorStephen Haberman <stephen@exigencecorp.com>
Tue, 23 Dec 2008 03:10:01 +0000 (21:10 -0600)
committerStephen Haberman <stephen@exigencecorp.com>
Tue, 23 Dec 2008 03:10:01 +0000 (21:10 -0600)
README.markdown
server/post-receive.sample [new file with mode: 0644]
server/update.sample [new file with mode: 0644]

index e8afad7..30367f8 100644 (file)
@@ -58,9 +58,19 @@ Bootstrapping Scripts
 [15]: master/scripts/create-gitconfig
 [16]: master/scripts/create-stable
 
+Install Server-side Hooks
+=========================
+
+* Download/clone the `gc` repo to something like `/srv/git/gc`
+* Edit `your_repo.git/hooks/post-receive` and `your_repo.git/hooks/update` to call the `gc` hooks as appropriate
+  * [post-receive.sample][17] and [update.sample][18] are good templates to use for calling multiple hooks
+
+[17]: master/server/post-receive.sample
+[18]: master/server/update.sample
+
 Todo
 ====
 
 * Install approach for scripts
-* Install documentation for hooks
+* Install for client hooks
 
diff --git a/server/post-receive.sample b/server/post-receive.sample
new file mode 100644 (file)
index 0000000..bb2fc2d
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+nl=$'\n'
+input=""
+while read newref oldref refname ; do
+    input="$input$newref $oldref $refname$nl"
+done
+
+echo -n "$input" | /srv/git/gc/server/post-receive-one
+echo -n "$input" | /srv/git/gc/server/post-receive-two
+
diff --git a/server/update.sample b/server/update.sample
new file mode 100644 (file)
index 0000000..6176b99
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+/srv/git/gc/server/update-one $1 $2 $3 &&
+/srv/git/gc/server/update-two $1 $2 $3
+