summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.classpath20
-rw-r--r--build.moxie8
-rw-r--r--build.xml43
-rw-r--r--gitblit.iml60
-rw-r--r--releases.moxie11
-rw-r--r--src/main/java/com/gitblit/manager/ProjectManager.java15
-rw-r--r--src/main/java/com/gitblit/manager/RepositoryManager.java96
-rw-r--r--src/main/java/com/gitblit/servlet/RawServlet.java3
-rw-r--r--src/main/java/com/gitblit/tickets/TicketIndexer.java2
-rw-r--r--src/main/java/com/gitblit/wicket/pages/BlobPage.java5
-rw-r--r--src/main/java/com/gitblit/wicket/pages/RepositoryPage.java16
-rw-r--r--src/main/java/com/gitblit/wicket/panels/BasePanel.java11
-rw-r--r--src/main/java/com/gitblit/wicket/panels/HistoryPanel.java6
13 files changed, 188 insertions, 108 deletions
diff --git a/.classpath b/.classpath
index 519aa513..cecdbc6c 100644
--- a/.classpath
+++ b/.classpath
@@ -15,17 +15,17 @@
<classpathentry kind="lib" path="ext/slf4j-log4j12-1.7.5.jar" sourcepath="ext/src/slf4j-log4j12-1.7.5.jar" />
<classpathentry kind="lib" path="ext/javax.mail-1.5.1.jar" sourcepath="ext/src/javax.mail-1.5.1.jar" />
<classpathentry kind="lib" path="ext/javax.servlet-api-3.1.0.jar" sourcepath="ext/src/javax.servlet-api-3.1.0.jar" />
- <classpathentry kind="lib" path="ext/jetty-all-9.1.4.v20140401.jar" sourcepath="ext/src/jetty-all-9.1.4.v20140401.jar" />
+ <classpathentry kind="lib" path="ext/jetty-all-9.2.1.v20140609.jar" sourcepath="ext/src/jetty-all-9.2.1.v20140609.jar" />
<classpathentry kind="lib" path="ext/wicket-1.4.21.jar" sourcepath="ext/src/wicket-1.4.21.jar" />
<classpathentry kind="lib" path="ext/wicket-auth-roles-1.4.21.jar" sourcepath="ext/src/wicket-auth-roles-1.4.21.jar" />
<classpathentry kind="lib" path="ext/wicket-extensions-1.4.21.jar" sourcepath="ext/src/wicket-extensions-1.4.21.jar" />
- <classpathentry kind="lib" path="ext/lucene-core-4.6.0.jar" sourcepath="ext/src/lucene-core-4.6.0.jar" />
- <classpathentry kind="lib" path="ext/lucene-analyzers-common-4.6.0.jar" sourcepath="ext/src/lucene-analyzers-common-4.6.0.jar" />
- <classpathentry kind="lib" path="ext/lucene-highlighter-4.6.0.jar" sourcepath="ext/src/lucene-highlighter-4.6.0.jar" />
- <classpathentry kind="lib" path="ext/lucene-memory-4.6.0.jar" sourcepath="ext/src/lucene-memory-4.6.0.jar" />
- <classpathentry kind="lib" path="ext/lucene-queries-4.6.0.jar" sourcepath="ext/src/lucene-queries-4.6.0.jar" />
- <classpathentry kind="lib" path="ext/lucene-queryparser-4.6.0.jar" sourcepath="ext/src/lucene-queryparser-4.6.0.jar" />
- <classpathentry kind="lib" path="ext/lucene-sandbox-4.6.0.jar" sourcepath="ext/src/lucene-sandbox-4.6.0.jar" />
+ <classpathentry kind="lib" path="ext/lucene-core-4.8.1.jar" sourcepath="ext/src/lucene-core-4.8.1.jar" />
+ <classpathentry kind="lib" path="ext/lucene-analyzers-common-4.8.1.jar" sourcepath="ext/src/lucene-analyzers-common-4.8.1.jar" />
+ <classpathentry kind="lib" path="ext/lucene-highlighter-4.8.1.jar" sourcepath="ext/src/lucene-highlighter-4.8.1.jar" />
+ <classpathentry kind="lib" path="ext/lucene-memory-4.8.1.jar" sourcepath="ext/src/lucene-memory-4.8.1.jar" />
+ <classpathentry kind="lib" path="ext/lucene-queries-4.8.1.jar" sourcepath="ext/src/lucene-queries-4.8.1.jar" />
+ <classpathentry kind="lib" path="ext/lucene-queryparser-4.8.1.jar" sourcepath="ext/src/lucene-queryparser-4.8.1.jar" />
+ <classpathentry kind="lib" path="ext/lucene-sandbox-4.8.1.jar" sourcepath="ext/src/lucene-sandbox-4.8.1.jar" />
<classpathentry kind="lib" path="ext/jakarta-regexp-1.4.jar" />
<classpathentry kind="lib" path="ext/pegdown-1.4.2.jar" sourcepath="ext/src/pegdown-1.4.2.jar" />
<classpathentry kind="lib" path="ext/parboiled-java-1.1.6.jar" sourcepath="ext/src/parboiled-java-1.1.6.jar" />
@@ -40,14 +40,14 @@
<classpathentry kind="lib" path="ext/tracwiki-core-1.4.jar" sourcepath="ext/src/tracwiki-core-1.4.jar" />
<classpathentry kind="lib" path="ext/mediawiki-core-1.4.jar" sourcepath="ext/src/mediawiki-core-1.4.jar" />
<classpathentry kind="lib" path="ext/confluence-core-1.4.jar" sourcepath="ext/src/confluence-core-1.4.jar" />
- <classpathentry kind="lib" path="ext/org.eclipse.jgit-3.3.1.201403241930-r.jar" sourcepath="ext/src/org.eclipse.jgit-3.3.1.201403241930-r.jar" />
+ <classpathentry kind="lib" path="ext/org.eclipse.jgit-3.4.0.201406110918-r.jar" sourcepath="ext/src/org.eclipse.jgit-3.4.0.201406110918-r.jar" />
<classpathentry kind="lib" path="ext/jsch-0.1.50.jar" sourcepath="ext/src/jsch-0.1.50.jar" />
<classpathentry kind="lib" path="ext/JavaEWAH-0.7.9.jar" sourcepath="ext/src/JavaEWAH-0.7.9.jar" />
<classpathentry kind="lib" path="ext/httpclient-4.1.3.jar" sourcepath="ext/src/httpclient-4.1.3.jar" />
<classpathentry kind="lib" path="ext/httpcore-4.1.4.jar" sourcepath="ext/src/httpcore-4.1.4.jar" />
<classpathentry kind="lib" path="ext/commons-logging-1.1.1.jar" sourcepath="ext/src/commons-logging-1.1.1.jar" />
<classpathentry kind="lib" path="ext/commons-codec-1.7.jar" sourcepath="ext/src/commons-codec-1.7.jar" />
- <classpathentry kind="lib" path="ext/org.eclipse.jgit.http.server-3.3.1.201403241930-r.jar" sourcepath="ext/src/org.eclipse.jgit.http.server-3.3.1.201403241930-r.jar" />
+ <classpathentry kind="lib" path="ext/org.eclipse.jgit.http.server-3.4.0.201406110918-r.jar" sourcepath="ext/src/org.eclipse.jgit.http.server-3.4.0.201406110918-r.jar" />
<classpathentry kind="lib" path="ext/bcprov-jdk15on-1.49.jar" sourcepath="ext/src/bcprov-jdk15on-1.49.jar" />
<classpathentry kind="lib" path="ext/bcmail-jdk15on-1.49.jar" sourcepath="ext/src/bcmail-jdk15on-1.49.jar" />
<classpathentry kind="lib" path="ext/bcpkix-jdk15on-1.49.jar" sourcepath="ext/src/bcpkix-jdk15on-1.49.jar" />
diff --git a/build.moxie b/build.moxie
index 8eeb8875..33ae1eda 100644
--- a/build.moxie
+++ b/build.moxie
@@ -10,7 +10,7 @@ name: Gitblit
description: pure Java Git solution
groupId: com.gitblit
artifactId: gitblit
-version: 1.6.1-SNAPSHOT
+version: 1.7.0-SNAPSHOT
inceptionYear: 2011
# Current stable release
@@ -101,10 +101,10 @@ repositories: central, eclipse-snapshots, eclipse
# Convenience properties for dependencies
properties: {
- jetty.version : 9.1.4.v20140401
+ jetty.version : 9.2.1.v20140609
wicket.version : 1.4.21
- lucene.version : 4.6.0
- jgit.version : 3.3.1.201403241930-r
+ lucene.version : 4.8.1
+ jgit.version : 3.4.0.201406110918-r
groovy.version : 1.8.8
bouncycastle.version : 1.49
selenium.version : 2.28.0
diff --git a/build.xml b/build.xml
index fa02ee32..c88bd8fd 100644
--- a/build.xml
+++ b/build.xml
@@ -41,9 +41,10 @@
<mx:init verbose="no" mxroot="${moxie.dir}" />
<!-- Set Ant project properties -->
- <property name="distribution.zipfile" value="gitblit-${project.version}.zip" />
- <property name="distribution.tgzfile" value="gitblit-${project.version}.tar.gz" />
- <property name="distribution.warfile" value="gitblit-${project.version}.war" />
+ <property name="release.name" value="gitblit-${project.version}"/>
+ <property name="distribution.zipfile" value="${release.name}.zip" />
+ <property name="distribution.tgzfile" value="${release.name}.tar.gz" />
+ <property name="distribution.warfile" value="${release.name}.war" />
<property name="fedclient.zipfile" value="fedclient-${project.version}.zip" />
<property name="manager.zipfile" value="manager-${project.version}.zip" />
<property name="authority.zipfile" value="authority-${project.version}.zip" />
@@ -170,14 +171,17 @@
<echo>Building Gitblit GO ${project.version}</echo>
- <local name="go.dir" />
- <property name="go.dir" value="${project.outputDirectory}/go" />
+ <local name="go.dir"/>
+ <property name="go.dir" value="${project.outputDirectory}/go"/>
<delete dir="${go.dir}" />
+
+ <local name="go.release.dir" />
+ <property name="go.release.dir" value="${go.dir}/${release.name}" />
<local name="webinf" />
<property name="webinf" value="${project.compileOutputDirectory}/WEB-INF" />
- <prepareDataDirectory toDir="${go.dir}/data" />
+ <prepareDataDirectory toDir="${go.release.dir}/data" />
<!-- Copy the web.xml from the prototype web.xml -->
<copy todir="${webinf}" overwrite="true">
@@ -188,42 +192,43 @@
</copy>
<!-- Build jar -->
- <mx:jar destfile="${go.dir}/gitblit.jar" includeresources="true">
+ <mx:jar destfile="${go.release.dir}/gitblit.jar" includeresources="true">
<mainclass name="com.gitblit.GitBlitServer" />
<launcher paths="ext" />
</mx:jar>
<!-- Generate the docs for the GO build -->
- <generateDocs toDir="${go.dir}/docs" />
-
+ <generateDocs toDir="${go.release.dir}/docs" />
+
<!-- Create GO Windows Zip deployment -->
<mx:zip basedir="${go.dir}">
<!-- LICENSE and NOTICE -->
- <fileset dir="${basedir}" >
+ <zipfileset dir="${basedir}" prefix="${release.name}">
<include name="LICENSE" />
<include name="NOTICE" />
- </fileset>
+ </zipfileset>
<!-- Windows distrib files -->
- <zipfileset dir="${project.distrib.dir}/win" />
+ <zipfileset dir="${project.distrib.dir}/win" prefix="${release.name}"/>
<!-- Gitblit Authority data -->
- <zipfileset dir="${project.distrib.dir}/data/certs" prefix="data/certs" />
+ <zipfileset dir="${project.distrib.dir}/data/certs" prefix="${release.name}/data/certs" />
+
<!-- include all dependencies -->
- <dependencies prefix="ext" />
+ <dependencies prefix="${release.name}/ext" />
</mx:zip>
<!-- Create GO Linux/OSX tar.gz deployment -->
<mx:tar basedir="${go.dir}" longfile="gnu" compression="gzip">
<!-- LICENSE and NOTICE -->
- <fileset dir="${basedir}" >
+ <zipfileset dir="${basedir}" prefix="${release.name}">
<include name="LICENSE" />
<include name="NOTICE" />
- </fileset>
+ </zipfileset>
<!-- Linux/OSX distrib files -->
- <tarfileset dir="${project.distrib.dir}/linux" filemode="755" />
+ <tarfileset dir="${project.distrib.dir}/linux" filemode="755" prefix="${release.name}"/>
<!-- Gitblit Authority data -->
- <zipfileset dir="${project.distrib.dir}/data/certs" prefix="data/certs" />
+ <zipfileset dir="${project.distrib.dir}/data/certs" prefix="${release.name}/data/certs" />
<!-- include all dependencies -->
- <dependencies prefix="ext" />
+ <dependencies prefix="${release.name}/ext" />
</mx:tar>
</target>
diff --git a/gitblit.iml b/gitblit.iml
index 78828b68..e2031244 100644
--- a/gitblit.iml
+++ b/gitblit.iml
@@ -124,13 +124,13 @@
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="jetty-all-9.1.4.v20140401.jar">
+ <library name="jetty-all-9.2.1.v20140609.jar">
<CLASSES>
- <root url="jar://$MODULE_DIR$/ext/jetty-all-9.1.4.v20140401.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/jetty-all-9.2.1.v20140609.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$MODULE_DIR$/ext/src/jetty-all-9.1.4.v20140401.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/src/jetty-all-9.2.1.v20140609.jar!/" />
</SOURCES>
</library>
</orderEntry>
@@ -168,79 +168,79 @@
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="lucene-core-4.6.0.jar">
+ <library name="lucene-core-4.8.1.jar">
<CLASSES>
- <root url="jar://$MODULE_DIR$/ext/lucene-core-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/lucene-core-4.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$MODULE_DIR$/ext/src/lucene-core-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/src/lucene-core-4.8.1.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="lucene-analyzers-common-4.6.0.jar">
+ <library name="lucene-analyzers-common-4.8.1.jar">
<CLASSES>
- <root url="jar://$MODULE_DIR$/ext/lucene-analyzers-common-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/lucene-analyzers-common-4.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$MODULE_DIR$/ext/src/lucene-analyzers-common-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/src/lucene-analyzers-common-4.8.1.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="lucene-highlighter-4.6.0.jar">
+ <library name="lucene-highlighter-4.8.1.jar">
<CLASSES>
- <root url="jar://$MODULE_DIR$/ext/lucene-highlighter-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/lucene-highlighter-4.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$MODULE_DIR$/ext/src/lucene-highlighter-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/src/lucene-highlighter-4.8.1.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="lucene-memory-4.6.0.jar">
+ <library name="lucene-memory-4.8.1.jar">
<CLASSES>
- <root url="jar://$MODULE_DIR$/ext/lucene-memory-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/lucene-memory-4.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$MODULE_DIR$/ext/src/lucene-memory-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/src/lucene-memory-4.8.1.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="lucene-queries-4.6.0.jar">
+ <library name="lucene-queries-4.8.1.jar">
<CLASSES>
- <root url="jar://$MODULE_DIR$/ext/lucene-queries-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/lucene-queries-4.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$MODULE_DIR$/ext/src/lucene-queries-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/src/lucene-queries-4.8.1.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="lucene-queryparser-4.6.0.jar">
+ <library name="lucene-queryparser-4.8.1.jar">
<CLASSES>
- <root url="jar://$MODULE_DIR$/ext/lucene-queryparser-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/lucene-queryparser-4.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$MODULE_DIR$/ext/src/lucene-queryparser-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/src/lucene-queryparser-4.8.1.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="lucene-sandbox-4.6.0.jar">
+ <library name="lucene-sandbox-4.8.1.jar">
<CLASSES>
- <root url="jar://$MODULE_DIR$/ext/lucene-sandbox-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/lucene-sandbox-4.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$MODULE_DIR$/ext/src/lucene-sandbox-4.6.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/src/lucene-sandbox-4.8.1.jar!/" />
</SOURCES>
</library>
</orderEntry>
@@ -397,13 +397,13 @@
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="org.eclipse.jgit-3.3.1.201403241930-r.jar">
+ <library name="org.eclipse.jgit-3.4.0.201406110918-r.jar">
<CLASSES>
- <root url="jar://$MODULE_DIR$/ext/org.eclipse.jgit-3.3.1.201403241930-r.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/org.eclipse.jgit-3.4.0.201406110918-r.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$MODULE_DIR$/ext/src/org.eclipse.jgit-3.3.1.201403241930-r.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/src/org.eclipse.jgit-3.4.0.201406110918-r.jar!/" />
</SOURCES>
</library>
</orderEntry>
@@ -474,13 +474,13 @@
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="org.eclipse.jgit.http.server-3.3.1.201403241930-r.jar">
+ <library name="org.eclipse.jgit.http.server-3.4.0.201406110918-r.jar">
<CLASSES>
- <root url="jar://$MODULE_DIR$/ext/org.eclipse.jgit.http.server-3.3.1.201403241930-r.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/org.eclipse.jgit.http.server-3.4.0.201406110918-r.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$MODULE_DIR$/ext/src/org.eclipse.jgit.http.server-3.3.1.201403241930-r.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/src/org.eclipse.jgit.http.server-3.4.0.201406110918-r.jar!/" />
</SOURCES>
</library>
</orderEntry>
diff --git a/releases.moxie b/releases.moxie
index 2a301ba9..65c5b0a8 100644
--- a/releases.moxie
+++ b/releases.moxie
@@ -12,8 +12,13 @@ r25: {
fixes: ~
changes: ~
additions: ~
- dependencyChanges: ~
- contributors: ~
+ dependencyChanges:
+ - Jetty 9.2.1 (pr-202)
+ - Lucene 4.8.1 (pr-201)
+ - JGit 3.4.0 (pr-200)
+ contributors:
+ - James Moger
+ - David Ostrovsky
}
#
@@ -1432,6 +1437,6 @@ r1: {
- James Moger
}
-snapshot: &r25
+snapshot: ~
release: &r24
releases: &r[1..24]
diff --git a/src/main/java/com/gitblit/manager/ProjectManager.java b/src/main/java/com/gitblit/manager/ProjectManager.java
index b30f4f17..666f5210 100644
--- a/src/main/java/com/gitblit/manager/ProjectManager.java
+++ b/src/main/java/com/gitblit/manager/ProjectManager.java
@@ -178,19 +178,20 @@ public class ProjectManager implements IProjectManager {
map.put("", configs.get(""));
for (RepositoryModel model : repositoryManager.getRepositoryModels(user)) {
- String rootPath = StringUtils.getRootPath(model.name).toLowerCase();
- if (!map.containsKey(rootPath)) {
+ String projectPath = StringUtils.getRootPath(model.name);
+ String projectKey = projectPath.toLowerCase();
+ if (!map.containsKey(projectKey)) {
ProjectModel project;
- if (configs.containsKey(rootPath)) {
+ if (configs.containsKey(projectKey)) {
// clone the project model because it's repository list will
// be tailored for the requesting user
- project = DeepCopier.copy(configs.get(rootPath));
+ project = DeepCopier.copy(configs.get(projectKey));
} else {
- project = new ProjectModel(rootPath);
+ project = new ProjectModel(projectPath);
}
- map.put(rootPath, project);
+ map.put(projectKey, project);
}
- map.get(rootPath).addRepository(model);
+ map.get(projectKey).addRepository(model);
}
// sort projects, root project first
diff --git a/src/main/java/com/gitblit/manager/RepositoryManager.java b/src/main/java/com/gitblit/manager/RepositoryManager.java
index 6601336e..0160363e 100644
--- a/src/main/java/com/gitblit/manager/RepositoryManager.java
+++ b/src/main/java/com/gitblit/manager/RepositoryManager.java
@@ -422,11 +422,12 @@ public class RepositoryManager implements IRepositoryManager {
@Override
public void addToCachedRepositoryList(RepositoryModel model) {
if (settings.getBoolean(Keys.git.cacheRepositoryList, true)) {
- repositoryListCache.put(model.name.toLowerCase(), model);
+ String key = getRepositoryKey(model.name);
+ repositoryListCache.put(key, model);
// update the fork origin repository with this repository clone
if (!StringUtils.isEmpty(model.originRepository)) {
- String originKey = model.originRepository.toLowerCase();
+ String originKey = getRepositoryKey(model.originRepository);
if (repositoryListCache.containsKey(originKey)) {
RepositoryModel origin = repositoryListCache.get(originKey);
origin.addFork(model.name);
@@ -445,7 +446,8 @@ public class RepositoryManager implements IRepositoryManager {
if (StringUtils.isEmpty(name)) {
return null;
}
- return repositoryListCache.remove(name.toLowerCase());
+ String key = getRepositoryKey(name);
+ return repositoryListCache.remove(key);
}
/**
@@ -554,7 +556,7 @@ public class RepositoryManager implements IRepositoryManager {
// rebuild fork networks
for (RepositoryModel model : repositoryListCache.values()) {
if (!StringUtils.isEmpty(model.originRepository)) {
- String originKey = model.originRepository.toLowerCase();
+ String originKey = getRepositoryKey(model.originRepository);
if (repositoryListCache.containsKey(originKey)) {
RepositoryModel origin = repositoryListCache.get(originKey);
origin.addFork(model.name);
@@ -590,15 +592,13 @@ public class RepositoryManager implements IRepositoryManager {
/**
* Returns the JGit repository for the specified name.
*
- * @param repositoryName
+ * @param name
* @param logError
* @return repository or null
*/
@Override
- public Repository getRepository(String repositoryName, boolean logError) {
- // Decode url-encoded repository name (issue-278)
- // http://stackoverflow.com/questions/17183110
- repositoryName = repositoryName.replace("%7E", "~").replace("%7e", "~");
+ public Repository getRepository(String name, boolean logError) {
+ String repositoryName = fixRepositoryName(name);
if (isCollectingGarbage(repositoryName)) {
logger.warn(MessageFormat.format("Rejecting request for {0}, busy collecting garbage!", repositoryName));
@@ -680,16 +680,14 @@ public class RepositoryManager implements IRepositoryManager {
* Returns the repository model for the specified repository. This method
* does not consider user access permissions.
*
- * @param repositoryName
+ * @param name
* @return repository model or null
*/
@Override
- public RepositoryModel getRepositoryModel(String repositoryName) {
- // Decode url-encoded repository name (issue-278)
- // http://stackoverflow.com/questions/17183110
- repositoryName = repositoryName.replace("%7E", "~").replace("%7e", "~");
+ public RepositoryModel getRepositoryModel(String name) {
+ String repositoryName = fixRepositoryName(name);
- String repositoryKey = repositoryName.toLowerCase();
+ String repositoryKey = getRepositoryKey(repositoryName);
if (!repositoryListCache.containsKey(repositoryKey)) {
RepositoryModel model = loadRepositoryModel(repositoryName);
if (model == null) {
@@ -758,6 +756,52 @@ public class RepositoryManager implements IRepositoryManager {
}
/**
+ * Replaces illegal character patterns in a repository name.
+ *
+ * @param repositoryName
+ * @return a corrected name
+ */
+ private String fixRepositoryName(String repositoryName) {
+ if (StringUtils.isEmpty(repositoryName)) {
+ return repositoryName;
+ }
+
+ // Decode url-encoded repository name (issue-278)
+ // http://stackoverflow.com/questions/17183110
+ String name = repositoryName.replace("%7E", "~").replace("%7e", "~");
+ name = name.replace("%2F", "/").replace("%2f", "/");
+
+ if (name.charAt(name.length() - 1) == '/') {
+ name = name.substring(0, name.length() - 1);
+ }
+
+ // strip duplicate-slashes from requests for repositoryName (ticket-117, issue-454)
+ // specify first char as slash so we strip leading slashes
+ char lastChar = '/';
+ StringBuilder sb = new StringBuilder();
+ for (char c : name.toCharArray()) {
+ if (c == '/' && lastChar == c) {
+ continue;
+ }
+ sb.append(c);
+ lastChar = c;
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Returns the cache key for the repository name.
+ *
+ * @param repositoryName
+ * @return the cache key for the repository
+ */
+ private String getRepositoryKey(String repositoryName) {
+ String name = fixRepositoryName(repositoryName);
+ return StringUtils.stripDotGit(name).toLowerCase();
+ }
+
+ /**
* Workaround JGit. I need to access the raw config object directly in order
* to see if the config is dirty so that I can reload a repository model.
* If I use the stock JGit method to get the config it already reloads the
@@ -932,7 +976,8 @@ public class RepositoryManager implements IRepositoryManager {
if (!caseSensitiveCheck && settings.getBoolean(Keys.git.cacheRepositoryList, true)) {
// if we are caching use the cache to determine availability
// otherwise we end up adding a phantom repository to the cache
- return repositoryListCache.containsKey(repositoryName.toLowerCase());
+ String key = getRepositoryKey(repositoryName);
+ return repositoryListCache.containsKey(key);
}
Repository r = getRepository(repositoryName, false);
if (r == null) {
@@ -970,7 +1015,7 @@ public class RepositoryManager implements IRepositoryManager {
}
String userProject = ModelUtils.getPersonalPath(username);
if (settings.getBoolean(Keys.git.cacheRepositoryList, true)) {
- String originKey = origin.toLowerCase();
+ String originKey = getRepositoryKey(origin);
String userPath = userProject + "/";
// collect all origin nodes in fork network
@@ -987,7 +1032,7 @@ public class RepositoryManager implements IRepositoryManager {
}
if (originModel.originRepository != null) {
- String ooKey = originModel.originRepository.toLowerCase();
+ String ooKey = getRepositoryKey(originModel.originRepository);
roots.add(ooKey);
originModel = repositoryListCache.get(ooKey);
} else {
@@ -1000,7 +1045,8 @@ public class RepositoryManager implements IRepositoryManager {
if (repository.startsWith(userPath)) {
RepositoryModel model = repositoryListCache.get(repository);
if (!StringUtils.isEmpty(model.originRepository)) {
- if (roots.contains(model.originRepository.toLowerCase())) {
+ String ooKey = getRepositoryKey(model.originRepository);
+ if (roots.contains(ooKey)) {
// user has a fork in this graph
return model.name;
}
@@ -1038,9 +1084,11 @@ public class RepositoryManager implements IRepositoryManager {
public ForkModel getForkNetwork(String repository) {
if (settings.getBoolean(Keys.git.cacheRepositoryList, true)) {
// find the root, cached
- RepositoryModel model = repositoryListCache.get(repository.toLowerCase());
+ String key = getRepositoryKey(repository);
+ RepositoryModel model = repositoryListCache.get(key);
while (model.originRepository != null) {
- model = repositoryListCache.get(model.originRepository.toLowerCase());
+ String originKey = getRepositoryKey(model.originRepository);
+ model = repositoryListCache.get(originKey);
}
ForkModel root = getForkModelFromCache(model.name);
return root;
@@ -1056,7 +1104,8 @@ public class RepositoryManager implements IRepositoryManager {
}
private ForkModel getForkModelFromCache(String repository) {
- RepositoryModel model = repositoryListCache.get(repository.toLowerCase());
+ String key = getRepositoryKey(repository);
+ RepositoryModel model = repositoryListCache.get(key);
if (model == null) {
return null;
}
@@ -1371,7 +1420,8 @@ public class RepositoryManager implements IRepositoryManager {
// update this repository's origin's fork list
if (!StringUtils.isEmpty(repository.originRepository)) {
- RepositoryModel origin = repositoryListCache.get(repository.originRepository.toLowerCase());
+ String originKey = getRepositoryKey(repository.originRepository);
+ RepositoryModel origin = repositoryListCache.get(originKey);
if (origin != null && !ArrayUtils.isEmpty(origin.forks)) {
origin.forks.remove(repositoryName);
origin.forks.add(repository.name);
diff --git a/src/main/java/com/gitblit/servlet/RawServlet.java b/src/main/java/com/gitblit/servlet/RawServlet.java
index 15e036ea..0def062a 100644
--- a/src/main/java/com/gitblit/servlet/RawServlet.java
+++ b/src/main/java/com/gitblit/servlet/RawServlet.java
@@ -175,6 +175,9 @@ public class RawServlet extends DaggerServlet {
repository = path.substring(0, slash);
}
offset += slash;
+ if (offset == 0) {
+ offset++;
+ }
r = repositoryManager.getRepository(repository, false);
if (repository.equals(path)) {
// either only repository in url or no repository found
diff --git a/src/main/java/com/gitblit/tickets/TicketIndexer.java b/src/main/java/com/gitblit/tickets/TicketIndexer.java
index 3929a000..98fe6977 100644
--- a/src/main/java/com/gitblit/tickets/TicketIndexer.java
+++ b/src/main/java/com/gitblit/tickets/TicketIndexer.java
@@ -143,7 +143,7 @@ public class TicketIndexer {
private String escape(String value) {
if (value.charAt(0) != '"') {
- if (value.indexOf('/') > -1) {
+ if (value.indexOf('/') > -1 || value.indexOf('-') > -1) {
return "\"" + value + "\"";
}
}
diff --git a/src/main/java/com/gitblit/wicket/pages/BlobPage.java b/src/main/java/com/gitblit/wicket/pages/BlobPage.java
index f3d0bc92..0938fcde 100644
--- a/src/main/java/com/gitblit/wicket/pages/BlobPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/BlobPage.java
@@ -21,6 +21,7 @@ import java.util.Map;
import org.apache.wicket.Component;
import org.apache.wicket.PageParameters;
+import org.apache.wicket.RedirectException;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
@@ -52,6 +53,10 @@ public class BlobPage extends RepositoryPage {
final String blobPath = WicketUtils.getPath(params);
String [] encodings = getEncodings();
+ if (StringUtils.isEmpty(objectId) && StringUtils.isEmpty(blobPath)) {
+ throw new RedirectException(TreePage.class, WicketUtils.newRepositoryParameter(repositoryName));
+ }
+
if (StringUtils.isEmpty(blobPath)) {
// blob by objectid
diff --git a/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java b/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java
index fcf659af..253c4fe4 100644
--- a/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java
@@ -166,10 +166,10 @@ public abstract class RepositoryPage extends RootPage {
add(navigationPanel);
add(new ExternalLink("syndication", SyndicationServlet.asLink(getRequest()
- .getRelativePathPrefixToContextRoot(), repositoryName, null, 0)));
+ .getRelativePathPrefixToContextRoot(), getRepositoryName(), null, 0)));
// add floating search form
- SearchForm searchForm = new SearchForm("searchForm", repositoryName);
+ SearchForm searchForm = new SearchForm("searchForm", getRepositoryName());
add(searchForm);
searchForm.setTranslatedAttributes();
@@ -193,7 +193,7 @@ public abstract class RepositoryPage extends RootPage {
private List<NavLink> registerNavLinks() {
PageParameters params = null;
if (!StringUtils.isEmpty(repositoryName)) {
- params = WicketUtils.newRepositoryParameter(repositoryName);
+ params = WicketUtils.newRepositoryParameter(getRepositoryName());
}
List<NavLink> navLinks = new ArrayList<NavLink>();
@@ -216,7 +216,7 @@ public abstract class RepositoryPage extends RootPage {
navLinks.add(new PageNavLink("gb.commits", LogPage.class, params));
navLinks.add(new PageNavLink("gb.tree", TreePage.class, params));
if (app().tickets().isReady() && (app().tickets().isAcceptingNewTickets(model) || app().tickets().hasTickets(model))) {
- PageParameters tParams = WicketUtils.newOpenTicketsParameter(repositoryName);
+ PageParameters tParams = WicketUtils.newOpenTicketsParameter(getRepositoryName());
navLinks.add(new PageNavLink("gb.tickets", TicketsPage.class, tParams));
}
navLinks.add(new PageNavLink("gb.docs", DocsPage.class, params, true));
@@ -229,7 +229,7 @@ public abstract class RepositoryPage extends RootPage {
// per-repository extra navlinks
if (JGitUtils.getPagesBranch(r) != null) {
ExternalNavLink pagesLink = new ExternalNavLink("gb.pages", PagesServlet.asLink(
- getRequest().getRelativePathPrefixToContextRoot(), repositoryName, null), true);
+ getRequest().getRelativePathPrefixToContextRoot(), getRepositoryName(), null), true);
navLinks.add(pagesLink);
}
@@ -422,6 +422,10 @@ public abstract class RepositoryPage extends RootPage {
return m;
}
+ protected String getRepositoryName() {
+ return getRepositoryModel().name;
+ }
+
protected RevCommit getCommit() {
RevCommit commit = JGitUtils.getCommit(r, objectId);
if (commit == null) {
@@ -630,7 +634,7 @@ public abstract class RepositoryPage extends RootPage {
r = null;
}
// setup page header and footer
- setupPage(repositoryName, "/ " + getPageName());
+ setupPage(getRepositoryName(), "/ " + getPageName());
super.onBeforeRender();
}
diff --git a/src/main/java/com/gitblit/wicket/panels/BasePanel.java b/src/main/java/com/gitblit/wicket/panels/BasePanel.java
index e8f8f6f2..73f8e471 100644
--- a/src/main/java/com/gitblit/wicket/panels/BasePanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/BasePanel.java
@@ -22,6 +22,8 @@ import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.gitblit.Constants;
import com.gitblit.Keys;
@@ -36,6 +38,8 @@ public abstract class BasePanel extends Panel {
private transient TimeUtils timeUtils;
+ private transient Logger logger;
+
public BasePanel(String wicketId) {
super(wicketId);
}
@@ -44,6 +48,13 @@ public abstract class BasePanel extends Panel {
return GitBlitWebApp.get();
}
+ protected Logger logger() {
+ if (logger == null) {
+ logger = LoggerFactory.getLogger(getClass());
+ }
+ return logger;
+ }
+
protected String getContextUrl() {
return getRequest().getRelativePathPrefixToContextRoot();
}
diff --git a/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java b/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java
index 21f38388..e1706a09 100644
--- a/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java
@@ -38,8 +38,6 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import com.gitblit.Constants;
import com.gitblit.Keys;
@@ -63,8 +61,6 @@ public class HistoryPanel extends BasePanel {
private static final long serialVersionUID = 1L;
- private final Logger log = LoggerFactory.getLogger(getClass());
-
private boolean hasMore;
public HistoryPanel(String wicketId, final String repositoryName, final String objectId,
@@ -84,7 +80,7 @@ public class HistoryPanel extends BasePanel {
// commit missing
String msg = MessageFormat.format("Failed to find history of **{0}** *{1}*",
path, objectId);
- log.error(msg + " " + repositoryName);
+ logger().error(msg + " " + repositoryName);
add(new Label("commitHeader", MarkdownUtils.transformMarkdown(msg)).setEscapeModelStrings(false));
add(new Label("breadcrumbs"));
} else {