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/JGitUtils.java |   48 +++++++++++++++++++++---------------------------
 1 files changed, 21 insertions(+), 27 deletions(-)

diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java
index 5f193d0..72e948c 100644
--- a/src/com/gitblit/utils/JGitUtils.java
+++ b/src/com/gitblit/utils/JGitUtils.java
@@ -36,8 +36,6 @@
 import org.eclipse.jgit.api.CloneCommand;
 import org.eclipse.jgit.api.FetchCommand;
 import org.eclipse.jgit.api.Git;
-import org.eclipse.jgit.api.ResetCommand;
-import org.eclipse.jgit.api.ResetCommand.ResetType;
 import org.eclipse.jgit.diff.DiffEntry;
 import org.eclipse.jgit.diff.DiffEntry.ChangeType;
 import org.eclipse.jgit.diff.DiffFormatter;
@@ -253,27 +251,6 @@
 	}
 
 	/**
-	 * Reset HEAD to the latest remote tracking commit.
-	 * 
-	 * @param repository
-	 * @param remoteRef
-	 *            the remote tracking reference (e.g. origin/master)
-	 * @return Ref
-	 * @throws Exception
-	 */
-	public static Ref resetHEAD(Repository repository, String remoteRef) throws Exception {
-		if (!remoteRef.startsWith(Constants.R_REMOTES)) {
-			remoteRef = Constants.R_REMOTES + remoteRef;
-		}
-		Git git = new Git(repository);
-		ResetCommand reset = git.reset();
-		reset.setMode(ResetType.SOFT);
-		reset.setRef(remoteRef);
-		Ref result = reset.call();
-		return result;
-	}
-
-	/**
 	 * Creates a bare repository.
 	 * 
 	 * @param repositoriesFolder
@@ -324,6 +301,7 @@
 	 */
 	private static List<String> getRepositoryList(String basePath, File searchFolder,
 			boolean onlyBare, boolean searchSubfolders) {
+		File baseFile = new File(basePath);
 		List<String> list = new ArrayList<String>();
 		for (File file : searchFolder.listFiles()) {
 			if (file.isDirectory()) {
@@ -333,8 +311,7 @@
 						continue;
 					}
 					// determine repository name relative to base path
-					String repository = StringUtils.getRelativePath(basePath,
-							file.getAbsolutePath());
+					String repository = FileUtils.getRelativePath(baseFile, file);
 					list.add(repository);
 				} else if (searchSubfolders && file.canRead()) {
 					// look for repositories in subfolders
@@ -719,6 +696,10 @@
 				for (DiffEntry diff : diffs) {
 					if (diff.getChangeType().equals(ChangeType.DELETE)) {
 						list.add(new PathChangeModel(diff.getOldPath(), diff.getOldPath(), 0, diff
+								.getNewMode().getBits(), commit.getId().getName(), diff
+								.getChangeType()));
+					} else if (diff.getChangeType().equals(ChangeType.RENAME)) {
+						list.add(new PathChangeModel(diff.getOldPath(), diff.getNewPath(), 0, diff
 								.getNewMode().getBits(), commit.getId().getName(), diff
 								.getChangeType()));
 					} else {
@@ -1453,10 +1434,23 @@
 		List<RefModel> noteBranches = getNoteBranches(repository, true, -1);
 		for (RefModel notesRef : noteBranches) {
 			RevTree notesTree = JGitUtils.getCommit(repository, notesRef.getName()).getTree();
+			// flat notes list
+			String notePath = commit.getName();
+			String text = getStringContent(repository, notesTree, notePath);
+			if (!StringUtils.isEmpty(text)) {
+				List<RevCommit> history = getRevLog(repository, notesRef.getName(), notePath, 0, -1);
+				RefModel noteRef = new RefModel(notesRef.displayName, null, history.get(history
+						.size() - 1));
+				GitNote gitNote = new GitNote(noteRef, text);
+				list.add(gitNote);
+				continue;
+			}
+			
+			// folder structure
 			StringBuilder sb = new StringBuilder(commit.getName());
 			sb.insert(2, '/');
-			String notePath = sb.toString();
-			String text = getStringContent(repository, notesTree, notePath);
+			notePath = sb.toString();
+			text = getStringContent(repository, notesTree, notePath);
 			if (!StringUtils.isEmpty(text)) {
 				List<RevCommit> history = getRevLog(repository, notesRef.getName(), notePath, 0, -1);
 				RefModel noteRef = new RefModel(notesRef.displayName, null, history.get(history

--
Gitblit v1.9.1