From 5d9bd7e01c5e39a22687379d00d9622328162f6a Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Wed, 11 Jul 2012 17:17:00 -0400
Subject: [PATCH] Update to JGit 2.0.0

---
 src/com/gitblit/utils/IssueUtils.java   |    2 +-
 src/com/gitblit/GitBlit.java            |    9 +++++++++
 .classpath                              |    4 ++--
 src/com/gitblit/build/BuildGhPages.java |    2 +-
 src/com/gitblit/build/Build.java        |   12 ++++++------
 src/com/gitblit/Constants.java          |    2 +-
 src/com/gitblit/utils/JGitUtils.java    |    9 +++++++--
 7 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/.classpath b/.classpath
index 37eb634..1c3065c 100644
--- a/.classpath
+++ b/.classpath
@@ -26,8 +26,8 @@
 	<classpathentry kind="lib" path="ext/jetty-ajp-7.4.3.v20110701.jar" sourcepath="ext/jetty-ajp-7.4.3.v20110701-sources.jar"/>
 	<classpathentry kind="lib" path="ext/lucene-core-3.5.0.jar" sourcepath="ext/lucene-core-3.5.0-sources.jar"/>
 	<classpathentry kind="lib" path="ext/markdownpapers-core-1.2.7.jar" sourcepath="ext/markdownpapers-core-1.2.7-sources.jar"/>
-	<classpathentry kind="lib" path="ext/org.eclipse.jgit-1.3.0.201202151440-r.jar" sourcepath="ext/org.eclipse.jgit-1.3.0.201202151440-r-sources.jar"/>
-	<classpathentry kind="lib" path="ext/org.eclipse.jgit.http.server-1.3.0.201202151440-r.jar" sourcepath="ext/org.eclipse.jgit.http.server-1.3.0.201202151440-r-sources.jar"/>
+	<classpathentry kind="lib" path="ext/org.eclipse.jgit-2.0.0.201206130900-r.jar" sourcepath="ext/org.eclipse.jgit-2.0.0.201206130900-r-sources.jar"/>
+	<classpathentry kind="lib" path="ext/org.eclipse.jgit.http.server-2.0.0.201206130900-r.jar" sourcepath="ext/org.eclipse.jgit.http.server-2.0.0.201206130900-r-sources.jar"/>
 	<classpathentry kind="lib" path="ext/lucene-highlighter-3.5.0.jar" sourcepath="ext/lucene-highlighter-3.5.0-sources.jar"/>
 	<classpathentry kind="lib" path="ext/lucene-memory-3.5.0.jar" sourcepath="ext/lucene-memory-3.5.0-sources.jar"/>
 	<classpathentry kind="lib" path="ext/unboundid-ldapsdk-2.3.0.jar" sourcepath="ext/unboundid-ldapsdk-2.3.0-sources.jar"/>
diff --git a/src/com/gitblit/Constants.java b/src/com/gitblit/Constants.java
index 772c768..8153b44 100644
--- a/src/com/gitblit/Constants.java
+++ b/src/com/gitblit/Constants.java
@@ -38,7 +38,7 @@
 
 	// The build script extracts this exact line so be careful editing it
 	// and only use A-Z a-z 0-9 .-_ in the string.
-	public static final String JGIT_VERSION = "JGit 1.3.0 (201202151440-r)";
+	public static final String JGIT_VERSION = "JGit 2.0.0 (201206130900-r)";
 
 	public static final String ADMIN_ROLE = "#admin";
 
diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java
index 27d43c8..10b1253 100644
--- a/src/com/gitblit/GitBlit.java
+++ b/src/com/gitblit/GitBlit.java
@@ -58,6 +58,7 @@
 import org.eclipse.jgit.lib.StoredConfig;
 import org.eclipse.jgit.storage.file.WindowCache;
 import org.eclipse.jgit.storage.file.WindowCacheConfig;
+import org.eclipse.jgit.transport.ServiceMayNotContinueException;
 import org.eclipse.jgit.transport.resolver.FileResolver;
 import org.eclipse.jgit.transport.resolver.RepositoryResolver;
 import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
@@ -783,6 +784,12 @@
 				logger.error("GitBlit.getRepository(String) failed to find "
 						+ new File(repositoriesFolder, repositoryName).getAbsolutePath(), e);
 			}
+		} catch (ServiceMayNotContinueException e) {
+			r = null;
+			if (logError) {
+				logger.error("GitBlit.getRepository(String) failed to find "
+						+ new File(repositoriesFolder, repositoryName).getAbsolutePath(), e);
+			}
 		}
 		return r;
 	}
@@ -1087,6 +1094,8 @@
 				logger.error("Service not authorized", e);
 			} catch (ServiceNotEnabledException e) {
 				logger.error("Service not enabled", e);
+			} catch (ServiceMayNotContinueException e) {
+				logger.error("Service may not continue", e);
 			}
 		}
 
diff --git a/src/com/gitblit/build/Build.java b/src/com/gitblit/build/Build.java
index e75c4c4..ed54f9e 100644
--- a/src/com/gitblit/build/Build.java
+++ b/src/com/gitblit/build/Build.java
@@ -544,15 +544,15 @@
 				"3b7c5f3938f202311bdca0bf7ed46bc0118af081");
 
 		public static final MavenObject JGIT = new MavenObject("JGit", "org/eclipse/jgit",
-				"org.eclipse.jgit", "1.3.0.201202151440-r", 1532000, 1565000, 3460000,
-				"a00dc524b1d1db1abbf95407aa3e6009c3d2c157",
-				"68864beaa0856f539deafecf9e1fe105a7e996c3",
+				"org.eclipse.jgit", "2.0.0.201206130900-r", 1600000, 1565000, 3460000,
+				"c8934e903ef26ec9aa1d0d3b604979c77eda4137",
+				"7e2c1486bf13e7bbdf39b68554e9010abe385c32",
 				"");
 
 		public static final MavenObject JGIT_HTTP = new MavenObject("JGit", "org/eclipse/jgit",
-				"org.eclipse.jgit.http.server", "1.3.0.201202151440-r", 68000, 62000, 110000,
-				"099468bdd59d6f4919d54d5b66022d3ec8077b29",
-				"721ef2b857a7e92989a8f1ee688e361510303bb1",
+				"org.eclipse.jgit.http.server", "2.0.0.201206130900-r", 68000, 62000, 110000,
+				"d42535d996ccfc487092a8850e6e78d368de72d6",
+				"85d5ba16db13144815634aeff31ad6c7d92107e6",
 				"");
 
 		public static final MavenObject JSCH = new MavenObject("JSch", "com/jcraft", "jsch",
diff --git a/src/com/gitblit/build/BuildGhPages.java b/src/com/gitblit/build/BuildGhPages.java
index efeb43c..5982ac3 100644
--- a/src/com/gitblit/build/BuildGhPages.java
+++ b/src/com/gitblit/build/BuildGhPages.java
@@ -25,12 +25,12 @@
 import java.util.Set;
 import java.util.TreeSet;
 
-import org.eclipse.jgit.JGitText;
 import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheBuilder;
 import org.eclipse.jgit.dircache.DirCacheEntry;
+import org.eclipse.jgit.internal.JGitText;
 import org.eclipse.jgit.lib.CommitBuilder;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.FileMode;
diff --git a/src/com/gitblit/utils/IssueUtils.java b/src/com/gitblit/utils/IssueUtils.java
index cfd6200..7b24ccf 100644
--- a/src/com/gitblit/utils/IssueUtils.java
+++ b/src/com/gitblit/utils/IssueUtils.java
@@ -28,12 +28,12 @@
 import java.util.Set;
 import java.util.TreeSet;
 
-import org.eclipse.jgit.JGitText;
 import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheBuilder;
 import org.eclipse.jgit.dircache.DirCacheEntry;
+import org.eclipse.jgit.internal.JGitText;
 import org.eclipse.jgit.lib.CommitBuilder;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.FileMode;
diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java
index ab5b655..62d27da 100644
--- a/src/com/gitblit/utils/JGitUtils.java
+++ b/src/com/gitblit/utils/JGitUtils.java
@@ -35,6 +35,7 @@
 import org.eclipse.jgit.api.CloneCommand;
 import org.eclipse.jgit.api.FetchCommand;
 import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.diff.DiffEntry;
 import org.eclipse.jgit.diff.DiffEntry.ChangeType;
 import org.eclipse.jgit.diff.DiffFormatter;
@@ -257,8 +258,12 @@
 	 * @return Repository
 	 */
 	public static Repository createRepository(File repositoriesFolder, String name) {
-		Git git = Git.init().setDirectory(new File(repositoriesFolder, name)).setBare(true).call();
-		return git.getRepository();
+		try {
+			Git git = Git.init().setDirectory(new File(repositoriesFolder, name)).setBare(true).call();
+			return git.getRepository();
+		} catch (GitAPIException e) {
+			throw new RuntimeException(e);
+		}
 	}
 
 	/**

--
Gitblit v1.9.1