From 514da0237f6239322193d5d4b11b58fe4095da2b Mon Sep 17 00:00:00 2001
From: SHaselbauer <sarah.haselbauer@akquinet.de>
Date: Wed, 23 Jan 2013 10:27:42 -0500
Subject: [PATCH] seleniumFixV2: connected thread pool creation to condition web.allowLuceneIndexing (otherwise thread pool will be kept open for more than a minute, what hinders the start of another gitblit instance in the same jvm during selenium test case execution), fixed naming of xpath variables, added missing property to gitblit.properties and test-ui-gitblit.properties, changed naming of methods (according to decision that owners is a much shorter word than repository administrator and that owners is fits better if you think of collective responsibilities and collective ownership)

---
 src/com/gitblit/utils/JGitUtils.java |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java
index 815f8b5..1f2ae94 100644
--- a/src/com/gitblit/utils/JGitUtils.java
+++ b/src/com/gitblit/utils/JGitUtils.java
@@ -1616,6 +1616,32 @@
 		}
 		return null;
 	}
+	
+	public static String getSubmoduleCommitId(Repository repository, String path, RevCommit commit) {
+		String commitId = null;
+		RevWalk rw = new RevWalk(repository);
+		TreeWalk tw = new TreeWalk(repository);
+		tw.setFilter(PathFilterGroup.createFromStrings(Collections.singleton(path)));
+		try {
+			tw.reset(commit.getTree());
+			while (tw.next()) {
+				if (tw.isSubtree() && !path.equals(tw.getPathString())) {
+					tw.enterSubtree();
+					continue;
+				}
+				if (FileMode.GITLINK == tw.getFileMode(0)) {
+					commitId = tw.getObjectId(0).getName();
+					break;
+				}
+			}
+		} catch (Throwable t) {
+			error(t, repository, "{0} can't find {1} in commit {2}", path, commit.name());
+		} finally {
+			rw.dispose();
+			tw.release();
+		}
+		return commitId;
+	}
 
 	/**
 	 * Returns the list of notes entered about the commit from the refs/notes

--
Gitblit v1.9.1