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/utils/FileUtils.java |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/com/gitblit/utils/FileUtils.java b/src/com/gitblit/utils/FileUtils.java
index 29c9d0f..f8d35c8 100644
--- a/src/com/gitblit/utils/FileUtils.java
+++ b/src/com/gitblit/utils/FileUtils.java
@@ -149,4 +149,33 @@
 			}
 		}
 	}
+	
+	/**
+	 * Determine the relative path between two files.  Takes into account
+	 * canonical paths, if possible.
+	 * 
+	 * @param basePath
+	 * @param path
+	 * @return a relative path from basePath to path
+	 */
+	public static String getRelativePath(File basePath, File path) {
+		File exactBase = getExactFile(basePath);
+		File exactPath = getExactFile(path);
+		return StringUtils.getRelativePath(exactBase.getPath(), exactPath.getPath());
+	}
+	
+	/**
+	 * Returns the exact path for a file. This path will be the canonical path
+	 * unless an exception is thrown in which case it will be the absolute path.
+	 * 
+	 * @param path
+	 * @return the exact file
+	 */
+	public static File getExactFile(File path) {
+		try {
+			return path.getCanonicalFile();
+		} catch (IOException e) {
+			return path.getAbsoluteFile();
+		}
+	}
 }

--
Gitblit v1.9.1