]> source.dussan.org Git - gitblit.git/commitdiff
Completed migration to JGit 3.0.0-SNAPSHOT
authorJames Moger <james.moger@gitblit.com>
Mon, 15 Apr 2013 12:18:02 +0000 (08:18 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 15 Apr 2013 12:18:02 +0000 (08:18 -0400)
.classpath
build.moxie
gitblit.iml
releases.moxie
src/main/java/com/gitblit/AddIndexedBranch.java
src/main/java/com/gitblit/GCExecutor.java
src/main/java/com/gitblit/GitBlit.java
src/main/java/com/gitblit/utils/JGitUtils.java
src/test/java/com/gitblit/tests/GitBlitSuite.java
src/test/java/com/gitblit/tests/GitServletTest.java
src/test/java/com/gitblit/tests/PushLogTest.java

index 3cee78853e46fdc1be336f729dbf808e075d7cf2..ffb673d867475e86ce62206b30b229917746b23e 100644 (file)
        <classpathentry kind="lib" path="ext/lucene-queries-3.6.1.jar" sourcepath="ext/src/lucene-queries-3.6.1.jar" />
        <classpathentry kind="lib" path="ext/jakarta-regexp-1.4.jar" />
        <classpathentry kind="lib" path="ext/markdownpapers-core-1.3.2.jar" sourcepath="ext/src/markdownpapers-core-1.3.2.jar" />
-       <classpathentry kind="lib" path="ext/org.eclipse.jgit-2.3.1.201302201838-r.jar" sourcepath="ext/src/org.eclipse.jgit-2.3.1.201302201838-r.jar" />
+       <classpathentry kind="lib" path="ext/org.eclipse.jgit-3.0.0-SNAPSHOT.jar" sourcepath="ext/src/org.eclipse.jgit-3.0.0-SNAPSHOT.jar" />
        <classpathentry kind="lib" path="ext/jsch-0.1.46.jar" sourcepath="ext/src/jsch-0.1.46.jar" />
-       <classpathentry kind="lib" path="ext/org.eclipse.jgit.http.server-2.3.1.201302201838-r.jar" sourcepath="ext/src/org.eclipse.jgit.http.server-2.3.1.201302201838-r.jar" />
+       <classpathentry kind="lib" path="ext/JavaEWAH-0.5.6.jar" sourcepath="ext/src/JavaEWAH-0.5.6.jar" />
+       <classpathentry kind="lib" path="ext/org.eclipse.jgit.http.server-3.0.0-SNAPSHOT.jar" sourcepath="ext/src/org.eclipse.jgit.http.server-3.0.0-SNAPSHOT.jar" />
        <classpathentry kind="lib" path="ext/bcprov-jdk15on-1.47.jar" sourcepath="ext/src/bcprov-jdk15on-1.47.jar" />
        <classpathentry kind="lib" path="ext/bcmail-jdk15on-1.47.jar" sourcepath="ext/src/bcmail-jdk15on-1.47.jar" />
        <classpathentry kind="lib" path="ext/bcpkix-jdk15on-1.47.jar" sourcepath="ext/src/bcpkix-jdk15on-1.47.jar" />
index 2c4c6c23f418384cfeb573180ad108b88c881869..503ff5f28298ccda9d54703c027aad45d18a30cd 100644 (file)
@@ -3,14 +3,14 @@
 #
 
 # Specify minimum Moxie version required to build
-requires: 0.7.1
+requires: 0.7.2
 
 # Project Metadata
 name: Gitblit
 description: pure Java Git solution
 groupId: com.gitblit
 artifactId: gitblit
-version: 1.4.0-SNAPSHOT
+version: 1.3.0-SNAPSHOT
 inceptionYear: 2011
 
 # Current stable release
index 0fe7fe922cbc2aff1bc31909c0be158317bc7686..fe245be2ec885ca51e2bd454d9ab6d8021ae9acd 100644 (file)
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="org.eclipse.jgit-2.3.1.201302201838-r.jar">
+      <library name="org.eclipse.jgit-3.0.0-SNAPSHOT.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/org.eclipse.jgit-2.3.1.201302201838-r.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/org.eclipse.jgit-3.0.0-SNAPSHOT.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/org.eclipse.jgit-2.3.1.201302201838-r.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/org.eclipse.jgit-3.0.0-SNAPSHOT.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="org.eclipse.jgit.http.server-2.3.1.201302201838-r.jar">
+      <library name="JavaEWAH-0.5.6.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/org.eclipse.jgit.http.server-2.3.1.201302201838-r.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/JavaEWAH-0.5.6.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/org.eclipse.jgit.http.server-2.3.1.201302201838-r.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/JavaEWAH-0.5.6.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="org.eclipse.jgit.http.server-3.0.0-SNAPSHOT.jar">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/ext/org.eclipse.jgit.http.server-3.0.0-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$MODULE_DIR$/ext/src/org.eclipse.jgit.http.server-3.0.0-SNAPSHOT.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
index 78d533f29bb835389b9d8a35f122e2efb062ab29..30a42e2e51255ecdaf562ca6945ab3ef8046f9bd 100644 (file)
@@ -25,6 +25,8 @@ r17: {
         - Use standard ServletRequestWrapper instead of custom wrapper (issue 224)\r
 \r
        changes:\r
+        - Disable Gson's pretty printing which has a huge performance gain\r
+        - Properly set application/json content-type on api calls\r
         - Updated Polish translation\r
         \r
     additions: \r
@@ -44,6 +46,7 @@ r17: {
     contributors:\r
        - Bandarupalli Satyanarayana\r
        - Christian Aistleitner\r
+       - David Ostrovsky\r
        - Egbert Teeselink\r
        - Hige Maniya\r
        - Ikslawek\r
@@ -67,7 +70,7 @@ r17: {
     - github/dapengme\r
        \r
        dependencyChanges:\r
-       - JGit 2.3.1.201302201838-r\r
+       - JGit 3.0.0-SNAPSHOT\r
        \r
        settings:\r
        - { name: 'git.daemonBindInterface', defaultValue: 'localhost' }\r
index 67b77428b8079e5d18aa590a55baf383e0d7e405..e2f3dacff6461d11e46d405cbb425dee4afa5e31 100644 (file)
@@ -25,9 +25,8 @@ import java.util.TreeSet;
 \r
 import org.eclipse.jgit.lib.Repository;\r
 import org.eclipse.jgit.lib.RepositoryCache.FileKey;\r
-import org.eclipse.jgit.storage.file.FileBasedConfig;\r
+import org.eclipse.jgit.lib.StoredConfig;\r
 import org.eclipse.jgit.storage.file.FileRepositoryBuilder;\r
-import org.eclipse.jgit.internal.storage.file.FileRepository;\r
 import org.eclipse.jgit.util.FS;\r
 \r
 import com.beust.jcommander.JCommander;\r
@@ -88,8 +87,8 @@ public class AddIndexedBranch {
                        try {\r
                                // load repository config\r
                                File gitDir = FileKey.resolve(new File(folder, repo), FS.DETECTED);\r
-                               FileRepository repository = (FileRepository)new FileRepositoryBuilder().setGitDir(gitDir).build();\r
-                               FileBasedConfig config = repository.getConfig();\r
+                               Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();\r
+                               StoredConfig config = repository.getConfig();\r
                                config.load();\r
                                \r
                                Set<String> indexedBranches = new LinkedHashSet<String>();\r
index 19393aa651b050e51b1371819425de20ad6a4bb6..0a0c8ad54e89e29d5bd53891ec4a548ae46bee44 100644 (file)
@@ -20,14 +20,14 @@ import java.text.MessageFormat;
 import java.util.Calendar;\r
 import java.util.Date;\r
 import java.util.Map;\r
+import java.util.Properties;\r
 import java.util.concurrent.ConcurrentHashMap;\r
 import java.util.concurrent.atomic.AtomicBoolean;\r
 import java.util.concurrent.atomic.AtomicInteger;\r
 \r
+import org.eclipse.jgit.api.GarbageCollectCommand;\r
+import org.eclipse.jgit.api.Git;\r
 import org.eclipse.jgit.lib.Repository;\r
-import org.eclipse.jgit.internal.storage.file.FileRepository;\r
-import org.eclipse.jgit.internal.storage.file.GC;\r
-import org.eclipse.jgit.internal.storage.file.GC.RepoStatistics;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
 \r
@@ -141,10 +141,10 @@ public class GCExecutor implements Runnable {
                        }\r
                        boolean garbageCollected = false;\r
                        RepositoryModel model = null;\r
-                       FileRepository repository = null;\r
+                       Repository repository = null;\r
                        try {\r
                                model = GitBlit.self().getRepositoryModel(repositoryName);\r
-                               repository = (FileRepository) GitBlit.self().getRepository(repositoryName);\r
+                               repository = GitBlit.self().getRepository(repositoryName);\r
                                if (repository == null) {\r
                                        logger.warn(MessageFormat.format("GCExecutor is missing repository {0}?!?", repositoryName));\r
                                        continue;\r
@@ -165,8 +165,9 @@ public class GCExecutor implements Runnable {
                                \r
                                logger.debug(MessageFormat.format("GCExecutor locked idle repository {0}", repositoryName));\r
                                \r
-                               GC gc = new GC(repository);\r
-                               RepoStatistics stats = gc.getStatistics();\r
+                               Git git = new Git(repository);\r
+                               GarbageCollectCommand gc = git.gc();\r
+                               Properties stats = gc.getStatistics();\r
                                \r
                                // determine if this is a scheduled GC\r
                                Calendar cal = Calendar.getInstance();\r
@@ -181,16 +182,17 @@ public class GCExecutor implements Runnable {
 \r
                                // determine if filesize triggered GC\r
                                long gcThreshold = FileUtils.convertSizeToLong(model.gcThreshold, 500*1024L);\r
-                               boolean hasEnoughGarbage = stats.sizeOfLooseObjects >= gcThreshold;\r
+                               long sizeOfLooseObjects = (Long) stats.get("sizeOfLooseObjects");\r
+                               boolean hasEnoughGarbage = sizeOfLooseObjects >= gcThreshold;\r
 \r
                                // if we satisfy one of the requirements, GC\r
-                               boolean hasGarbage = stats.sizeOfLooseObjects > 0;\r
+                               boolean hasGarbage = sizeOfLooseObjects > 0;\r
                                if (hasGarbage && (hasEnoughGarbage || shouldCollectGarbage)) {\r
-                                       long looseKB = stats.sizeOfLooseObjects/1024L;\r
+                                       long looseKB = sizeOfLooseObjects/1024L;\r
                                        logger.info(MessageFormat.format("Collecting {1} KB of loose objects from {0}", repositoryName, looseKB));\r
                                        \r
                                        // do the deed\r
-                                       gc.gc();\r
+                                       gc.call();\r
                                        \r
                                        garbageCollected = true;\r
                                }\r
@@ -217,7 +219,7 @@ public class GCExecutor implements Runnable {
                running.set(false);\r
        }\r
        \r
-       private boolean isRepositoryIdle(FileRepository repository) {\r
+       private boolean isRepositoryIdle(Repository repository) {\r
                try {\r
                        // Read the use count.\r
                        // An idle use count is 2:\r
index 27ab6ecfd8b1e483d64f03616ad71b4834672e3a..0f1b73bfb9a2ea4b611c11875923102633a2bc9a 100644 (file)
@@ -71,7 +71,6 @@ import org.eclipse.jgit.lib.RepositoryCache;
 import org.eclipse.jgit.lib.RepositoryCache.FileKey;\r
 import org.eclipse.jgit.lib.StoredConfig;\r
 import org.eclipse.jgit.storage.file.FileBasedConfig;\r
-import org.eclipse.jgit.internal.storage.file.WindowCache;\r
 import org.eclipse.jgit.storage.file.WindowCacheConfig;\r
 import org.eclipse.jgit.util.FS;\r
 import org.eclipse.jgit.util.FileUtils;\r
@@ -3186,7 +3185,7 @@ public class GitBlit implements ServletContextListener {
                cfg.setPackedGitMMAP(settings.getBoolean(Keys.git.packedGitMmap, cfg.isPackedGitMMAP()));\r
 \r
                try {\r
-                       WindowCache.reconfigure(cfg);\r
+                       cfg.install();\r
                        logger.debug(MessageFormat.format("{0} = {1,number,0}", Keys.git.packedGitWindowSize, cfg.getPackedGitWindowSize()));\r
                        logger.debug(MessageFormat.format("{0} = {1,number,0}", Keys.git.packedGitLimit, cfg.getPackedGitLimit()));\r
                        logger.debug(MessageFormat.format("{0} = {1,number,0}", Keys.git.deltaBaseCacheLimit, cfg.getDeltaBaseCacheLimit()));\r
index 8a02a652801efe1163b5a5d95aa354a0a52861a1..1e0ea5d6badaa54953812efd32e812788b0f9644 100644 (file)
@@ -67,7 +67,6 @@ import org.eclipse.jgit.revwalk.RevTree;
 import org.eclipse.jgit.revwalk.RevWalk;\r
 import org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter;\r
 import org.eclipse.jgit.revwalk.filter.RevFilter;\r
-import org.eclipse.jgit.internal.storage.file.FileRepository;\r
 import org.eclipse.jgit.storage.file.FileRepositoryBuilder;\r
 import org.eclipse.jgit.transport.CredentialsProvider;\r
 import org.eclipse.jgit.transport.FetchResult;\r
@@ -199,7 +198,7 @@ public class JGitUtils {
                File folder = new File(repositoriesFolder, name);\r
                if (folder.exists()) {\r
                        File gitDir = FileKey.resolve(new File(repositoriesFolder, name), FS.DETECTED);\r
-                       FileRepository repository = (FileRepository)new FileRepositoryBuilder().setGitDir(gitDir).build();\r
+                       Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();\r
                        result.fetchResult = fetchRepository(credentialsProvider, repository);\r
                        repository.close();\r
                } else {\r
index 0b8437a68b42c4de3bcc3d0be5281c763597aaf0..82552ec111f973db4bb2e7ea172a6b2ab55c793d 100644 (file)
@@ -25,7 +25,7 @@ import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.lib.Repository;\r
 import org.eclipse.jgit.lib.RepositoryCache;\r
 import org.eclipse.jgit.lib.RepositoryCache.FileKey;\r
-import org.eclipse.jgit.internal.storage.file.FileRepository;\r
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;\r
 import org.eclipse.jgit.util.FS;\r
 import org.junit.AfterClass;\r
 import org.junit.BeforeClass;\r
@@ -78,32 +78,38 @@ public class GitBlitSuite {
        private static AtomicBoolean started = new AtomicBoolean(false);\r
 \r
        public static Repository getHelloworldRepository() throws Exception {\r
-               return new FileRepository(new File(REPOSITORIES, "helloworld.git"));\r
+               return getRepository("helloworld.git");\r
        }\r
 \r
        public static Repository getTicgitRepository() throws Exception {\r
-               return new FileRepository(new File(REPOSITORIES, "ticgit.git"));\r
+               return getRepository("ticgit.git");\r
        }\r
 \r
        public static Repository getJGitRepository() throws Exception {\r
-               return new FileRepository(new File(REPOSITORIES, "test/jgit.git"));\r
+               return getRepository("test/jgit.git");\r
        }\r
 \r
        public static Repository getAmbitionRepository() throws Exception {\r
-               return new FileRepository(new File(REPOSITORIES, "test/ambition.git"));\r
+               return getRepository("test/ambition.git");\r
        }\r
 \r
        public static Repository getTheoreticalPhysicsRepository() throws Exception {\r
-               return new FileRepository(new File(REPOSITORIES, "test/theoretical-physics.git"));\r
+               return getRepository("test/theoretical-physics.git");\r
        }\r
 \r
        public static Repository getIssuesTestRepository() throws Exception {\r
                JGitUtils.createRepository(REPOSITORIES, "gb-issues.git").close();\r
-               return new FileRepository(new File(REPOSITORIES, "gb-issues.git"));\r
+               return getRepository("gb-issues.git");\r
        }\r
        \r
        public static Repository getGitectiveRepository() throws Exception {\r
-               return new FileRepository(new File(REPOSITORIES, "test/gitective.git"));\r
+               return getRepository("test/gitective.git");\r
+       }\r
+       \r
+       private static Repository getRepository(String name) throws Exception {\r
+               File gitDir = FileKey.resolve(new File(REPOSITORIES, name), FS.DETECTED);\r
+               Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();\r
+               return repository;\r
        }\r
 \r
        public static boolean startGitblit() throws Exception {\r
index 6f1d600d42d5b166971fb06069446485bdb02d4a..c1aaf1a3571dc131c0aac8fecfd6bdf4d911e29f 100644 (file)
@@ -19,8 +19,9 @@ import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.ResetCommand.ResetType;\r
 import org.eclipse.jgit.api.errors.GitAPIException;\r
 import org.eclipse.jgit.lib.Constants;\r
+import org.eclipse.jgit.lib.Repository;\r
 import org.eclipse.jgit.revwalk.RevCommit;\r
-import org.eclipse.jgit.internal.storage.file.FileRepository;\r
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;\r
 import org.eclipse.jgit.transport.CredentialsProvider;\r
 import org.eclipse.jgit.transport.PushResult;\r
 import org.eclipse.jgit.transport.RefSpec;\r
@@ -786,7 +787,7 @@ public class GitServletTest {
        public void testPushLog() throws IOException {\r
                String name = "refchecks/ticgit.git";\r
                File refChecks = new File(GitBlitSuite.REPOSITORIES, name);\r
-               FileRepository repository = new FileRepository(refChecks);\r
+               Repository repository = new FileRepositoryBuilder().setGitDir(refChecks).build();\r
                List<PushLogEntry> pushes = PushLogUtils.getPushLog(name, repository);\r
                GitBlitSuite.close(repository);\r
                assertTrue("Repository has an empty push log!", pushes.size() > 0);\r
index 0e01344e02ea00c9228506c9a2c225bdea9aad15..0f46b53bfbdc01f891c5d775d919b9858296dc1d 100644 (file)
@@ -19,7 +19,10 @@ import java.io.File;
 import java.io.IOException;\r
 import java.util.List;\r
 \r
-import org.eclipse.jgit.internal.storage.file.FileRepository;\r
+import org.eclipse.jgit.lib.Repository;\r
+import org.eclipse.jgit.lib.RepositoryCache.FileKey;\r
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;\r
+import org.eclipse.jgit.util.FS;\r
 import org.junit.Test;\r
 \r
 import com.gitblit.models.PushLogEntry;\r
@@ -30,7 +33,8 @@ public class PushLogTest {
        @Test\r
        public void testPushLog() throws IOException {\r
                String name = "~james/helloworld.git";\r
-               FileRepository repository = new FileRepository(new File(GitBlitSuite.REPOSITORIES, name));\r
+               File gitDir = FileKey.resolve(new File(GitBlitSuite.REPOSITORIES, name), FS.DETECTED);\r
+               Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();\r
                List<PushLogEntry> pushes = PushLogUtils.getPushLog(name, repository);\r
                GitBlitSuite.close(repository);\r
        }\r