From 0e44acbb2fec928a1606dc60f427a148fff405c9 Mon Sep 17 00:00:00 2001
From: Mohamed Ragab <moragab@gmail.com>
Date: Wed, 02 May 2012 11:15:01 -0400
Subject: [PATCH] Added a script to facilitate setting the proxy host and port and no proxy hosts, and then it concatenates all the java system properties for setting the java proxy configurations and puts the resulting string in an environment variable JAVA_PROXY_CONFIG, modified the scirpts gitblit,  gitblit-ubuntu, and gitblit-centos to source the java-proxy-config.sh script and then include the resulting java proxy configuration in the java command

---
 src/com/gitblit/GitServlet.java |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/com/gitblit/GitServlet.java b/src/com/gitblit/GitServlet.java
index 3b60e9f..94042c7 100644
--- a/src/com/gitblit/GitServlet.java
+++ b/src/com/gitblit/GitServlet.java
@@ -50,6 +50,8 @@
 
 import com.gitblit.models.RepositoryModel;
 import com.gitblit.models.UserModel;
+import com.gitblit.utils.ClientLogger;
+import com.gitblit.utils.FileUtils;
 import com.gitblit.utils.HttpUtils;
 import com.gitblit.utils.StringUtils;
 
@@ -165,7 +167,7 @@
 			scripts.addAll(GitBlit.self().getPreReceiveScriptsInherited(repository));
 			scripts.addAll(repository.preReceiveScripts);
 			UserModel user = getUserModel(rp);
-			runGroovy(repository, user, commands, scripts);
+			runGroovy(repository, user, commands, rp, scripts);
 			for (ReceiveCommand cmd : commands) {
 				if (!Result.NOT_ATTEMPTED.equals(cmd.getResult())) {
 					logger.warn(MessageFormat.format("{0} {1} because \"{2}\"", cmd.getNewId()
@@ -193,7 +195,7 @@
 			scripts.addAll(GitBlit.self().getPostReceiveScriptsInherited(repository));
 			scripts.addAll(repository.postReceiveScripts);
 			UserModel user = getUserModel(rp);
-			runGroovy(repository, user, commands, scripts);
+			runGroovy(repository, user, commands, rp, scripts);
 
 			// Experimental
 			// runNativeScript(rp, "hooks/post-receive", commands);
@@ -207,9 +209,7 @@
 		 */
 		protected RepositoryModel getRepositoryModel(ReceivePack rp) {
 			Repository repository = rp.getRepository();
-			String rootPath = GitBlit.getRepositoriesFolder().getAbsolutePath();
-			String repositoryName = StringUtils.getRelativePath(rootPath, repository.getDirectory()
-					.getAbsolutePath());
+			String repositoryName = FileUtils.getRelativePath(GitBlit.getRepositoriesFolder(), repository.getDirectory());
 			RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);
 			return model;
 		}
@@ -239,7 +239,7 @@
 		 * @param scripts
 		 */
 		protected void runGroovy(RepositoryModel repository, UserModel user,
-				Collection<ReceiveCommand> commands, Set<String> scripts) {
+				Collection<ReceiveCommand> commands, ReceivePack rp, Set<String> scripts) {
 			if (scripts == null || scripts.size() == 0) {
 				// no Groovy scripts to execute
 				return;
@@ -252,6 +252,7 @@
 			binding.setVariable("commands", commands);
 			binding.setVariable("url", gitblitUrl);
 			binding.setVariable("logger", logger);
+			binding.setVariable("clientLogger", new ClientLogger(rp));
 			for (String script : scripts) {
 				if (StringUtils.isEmpty(script)) {
 					continue;

--
Gitblit v1.9.1