From 819efdc8c5ea633e9be1e744ade8b197d21a1962 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sat, 12 Apr 2014 11:31:03 -0400
Subject: [PATCH] Allow ReceiveHook extensions

---
 src/site/setup_plugins.mkd |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/src/site/setup_plugins.mkd b/src/site/setup_plugins.mkd
index b609a68..b956cc1 100644
--- a/src/site/setup_plugins.mkd
+++ b/src/site/setup_plugins.mkd
@@ -54,13 +54,47 @@
 
 ### Extension Point: SSH DispatchCommand
 
-You can provide your own custom SSH commands by extending the DispatchCommand.
+You can provide your own custom SSH commands by extending the *DispatchCommand* class.
 
 For some examples of how to do this, please see:
 
 [gitblit-cookbook-plugin (Maven project)](https://dev.gitblit.com/summary/gitblit-cookbook-plugin.git)
 [gitblit-powertools-plugin (Ant/Moxie project)](https://dev.gitblit.com/summary/gitblit-powertools-plugin.git)
 
+### Extension Point: Pre- and Post- Receive Hook
+
+You can provide your own custom pre and/or post receive hooks by extending the *ReceiveHook* class.
+
+```java
+import com.gitblit.extensions.ReceiveHook;
+import ro.fortsoft.pf4j.Extension;
+
+@Extension
+public class MyHook extends ReceiveHook {
+
+    @Override
+    public void onPreReceive(GitblitReceivePack receivePack, Collection<ReceiveCommand> commands) {
+        RepositoryModel repository = receivePack.getRepositoryModel();
+        UserModel user = receivePack.getUserModel();
+        receivePack.sendInfo("Hi {0}, I see {1} commands for {2} onPreReceive",
+                        user.getDisplayName(),
+                        commands.size(),
+                        repository.name);
+    }
+
+    @Override
+    public void onPostReceive(GitblitReceivePack receivePack, Collection<ReceiveCommand> commands) {
+        RepositoryModel repository = receivePack.getRepositoryModel();
+        UserModel user = receivePack.getUserModel();
+        receivePack.sendInfo("Hi {0}, I see {1} commands for {2} onPostReceive",
+                        user.getDisplayName(),
+                        commands.size(),
+                        repository.name);
+    }
+}
+
+```
+
 ### Mac OSX Fonts
 
 Gitblit's core SSH commands and those in the *powertools* plugin rely on use of ANSI border characters to provide a pretty presentation of data.  Unfortunately, the fonts provided by Apple - while very nice - don't work well with ANSI border characters.  The following public domain fixed-width, fixed-point, bitmapped fonts work very nicely.  I find the 6x12 font with a line spacing of ~0.8 to be quite acceptable.

--
Gitblit v1.9.1