From 6bb3b233c8a73d4fe4e5024794029fdc75a9f1bb Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 14 Sep 2012 09:36:46 -0400
Subject: [PATCH] Expose ReceivePack to Groovy hooks (issue 125)

---
 docs/04_releases.mkd            |    1 +
 groovy/jenkins.groovy           |    1 +
 groovy/sendmail.groovy          |    1 +
 groovy/blockpush.groovy         |    1 +
 groovy/localclone.groovy        |    1 +
 src/com/gitblit/GitServlet.java |    1 +
 groovy/protect-refs.groovy      |    1 +
 7 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd
index fd112d5..0ef571c 100644
--- a/docs/04_releases.mkd
+++ b/docs/04_releases.mkd
@@ -19,6 +19,7 @@
 
 #### changes
 
+- Expose ReceivePack to Groovy push hooks (issue 125)
 - Redirect to summary page when refreshing the empty repository page on a repository that is not empty (issue 129)
 - Emit a warning in the log file if running on a Tomcat-based servlet container which is unfriendly to %2F forward-slash url encoding AND Gitblit is configured to mount parameters with %2F forward-slash url encoding (Github/jpyeron, issue 126)
 - LDAP admin attribute setting is now consistent with LDAP teams setting and admin teams list.  
diff --git a/groovy/blockpush.groovy b/groovy/blockpush.groovy
index d0e2c2e..caef330 100644
--- a/groovy/blockpush.groovy
+++ b/groovy/blockpush.groovy
@@ -53,6 +53,7 @@
  * Bound Variables:
  *  gitblit			Gitblit Server	 			com.gitblit.GitBlit
  *  repository		Gitblit Repository			com.gitblit.models.RepositoryModel
+ *  receivePack		JGit Receive Pack			org.eclipse.jgit.transport.ReceivePack
  *  user			Gitblit User				com.gitblit.models.UserModel
  *  commands		JGit commands 				Collection<org.eclipse.jgit.transport.ReceiveCommand>
  *	url				Base url for Gitblit		String
diff --git a/groovy/jenkins.groovy b/groovy/jenkins.groovy
index 7336058..d76a3d6 100644
--- a/groovy/jenkins.groovy
+++ b/groovy/jenkins.groovy
@@ -48,6 +48,7 @@
  * Bound Variables:
  *  gitblit			Gitblit Server	 			com.gitblit.GitBlit
  *  repository		Gitblit Repository			com.gitblit.models.RepositoryModel
+ *  receivePack		JGit Receive Pack			org.eclipse.jgit.transport.ReceivePack
  *  user			Gitblit User				com.gitblit.models.UserModel
  *  commands		JGit commands 				Collection<org.eclipse.jgit.transport.ReceiveCommand>
  *	url				Base url for Gitblit		String
diff --git a/groovy/localclone.groovy b/groovy/localclone.groovy
index 11868d7..49b7f8b 100644
--- a/groovy/localclone.groovy
+++ b/groovy/localclone.groovy
@@ -58,6 +58,7 @@
  * Bound Variables:
  *  gitblit			Gitblit Server	 			com.gitblit.GitBlit
  *  repository		Gitblit Repository			com.gitblit.models.RepositoryModel
+ *  receivePack		JGit Receive Pack			org.eclipse.jgit.transport.ReceivePack
  *  user			Gitblit User				com.gitblit.models.UserModel
  *  commands		JGit commands 				Collection<org.eclipse.jgit.transport.ReceiveCommand>
  *	url				Base url for Gitblit		String
diff --git a/groovy/protect-refs.groovy b/groovy/protect-refs.groovy
index f730bcb..b1b611f 100644
--- a/groovy/protect-refs.groovy
+++ b/groovy/protect-refs.groovy
@@ -59,6 +59,7 @@
  * Bound Variables:
  *  gitblit			Gitblit Server	 			com.gitblit.GitBlit
  *  repository		Gitblit Repository			com.gitblit.models.RepositoryModel
+ *  receivePack		JGit Receive Pack			org.eclipse.jgit.transport.ReceivePack
  *  user			Gitblit User				com.gitblit.models.UserModel
  *  commands		JGit commands 				Collection<org.eclipse.jgit.transport.ReceiveCommand>
  *	url				Base url for Gitblit		String
diff --git a/groovy/sendmail.groovy b/groovy/sendmail.groovy
index f3fe0fa..c832bc6 100644
--- a/groovy/sendmail.groovy
+++ b/groovy/sendmail.groovy
@@ -54,6 +54,7 @@
  * Bound Variables:
  *  gitblit			Gitblit Server	 			com.gitblit.GitBlit
  *  repository		Gitblit Repository			com.gitblit.models.RepositoryModel
+ *  receivePack		JGit Receive Pack			org.eclipse.jgit.transport.ReceivePack
  *  user			Gitblit User				com.gitblit.models.UserModel
  *  commands		JGit commands 				Collection<org.eclipse.jgit.transport.ReceiveCommand>
  *	url				Base url for Gitblit		String
diff --git a/src/com/gitblit/GitServlet.java b/src/com/gitblit/GitServlet.java
index d81703d..2571693 100644
--- a/src/com/gitblit/GitServlet.java
+++ b/src/com/gitblit/GitServlet.java
@@ -249,6 +249,7 @@
 			Binding binding = new Binding();
 			binding.setVariable("gitblit", GitBlit.self());
 			binding.setVariable("repository", repository);
+			binding.setVariable("receivePack", rp);
 			binding.setVariable("user", user);
 			binding.setVariable("commands", commands);
 			binding.setVariable("url", gitblitUrl);

--
Gitblit v1.9.1