summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/gitblit')
-rw-r--r--src/com/gitblit/Build.java9
-rw-r--r--src/com/gitblit/BuildSite.java22
-rw-r--r--src/com/gitblit/Constants.java2
-rw-r--r--src/com/gitblit/DownloadZipServlet.java2
-rw-r--r--src/com/gitblit/GitBlit.java13
-rw-r--r--src/com/gitblit/GitBlitServer.java39
-rw-r--r--src/com/gitblit/GitBlitServlet.java2
-rw-r--r--src/com/gitblit/ILoginService.java2
-rw-r--r--src/com/gitblit/JettyLoginService.java2
-rw-r--r--src/com/gitblit/MakeCertificate.java6
-rw-r--r--src/com/gitblit/models/Metric.java (renamed from src/com/gitblit/wicket/models/Metric.java)2
-rw-r--r--src/com/gitblit/models/PathModel.java (renamed from src/com/gitblit/wicket/models/PathModel.java)7
-rw-r--r--src/com/gitblit/models/RefModel.java (renamed from src/com/gitblit/wicket/models/RefModel.java)6
-rw-r--r--src/com/gitblit/models/RepositoryModel.java (renamed from src/com/gitblit/wicket/models/RepositoryModel.java)4
-rw-r--r--src/com/gitblit/models/TicketModel.java (renamed from src/com/gitblit/wicket/models/TicketModel.java)8
-rw-r--r--src/com/gitblit/models/UserModel.java (renamed from src/com/gitblit/wicket/models/UserModel.java)2
-rw-r--r--src/com/gitblit/utils/DiffUtils.java149
-rw-r--r--src/com/gitblit/utils/JGitUtils.java147
-rw-r--r--src/com/gitblit/wicket/AuthorizationStrategy.java6
-rw-r--r--src/com/gitblit/wicket/GitBlitWebApp.java2
-rw-r--r--src/com/gitblit/wicket/GitBlitWebSession.java2
-rw-r--r--src/com/gitblit/wicket/RequiresAdminRole.java (renamed from src/com/gitblit/wicket/AdminPage.java)2
-rw-r--r--src/com/gitblit/wicket/pages/BasePage.html (renamed from src/com/gitblit/wicket/BasePage.html)6
-rw-r--r--src/com/gitblit/wicket/pages/BasePage.java (renamed from src/com/gitblit/wicket/BasePage.java)6
-rw-r--r--src/com/gitblit/wicket/pages/BlobDiffPage.java6
-rw-r--r--src/com/gitblit/wicket/pages/BlobPage.java1
-rw-r--r--src/com/gitblit/wicket/pages/BranchesPage.java1
-rw-r--r--src/com/gitblit/wicket/pages/CommitDiffPage.java8
-rw-r--r--src/com/gitblit/wicket/pages/CommitPage.java5
-rw-r--r--src/com/gitblit/wicket/pages/DocsPage.java5
-rw-r--r--src/com/gitblit/wicket/pages/EditRepositoryPage.java7
-rw-r--r--src/com/gitblit/wicket/pages/EditUserPage.java9
-rw-r--r--src/com/gitblit/wicket/pages/HistoryPage.java1
-rw-r--r--src/com/gitblit/wicket/pages/LogPage.java1
-rw-r--r--src/com/gitblit/wicket/pages/LoginPage.html (renamed from src/com/gitblit/wicket/LoginPage.html)6
-rw-r--r--src/com/gitblit/wicket/pages/LoginPage.java (renamed from src/com/gitblit/wicket/LoginPage.java)59
-rw-r--r--src/com/gitblit/wicket/pages/LogoutPage.java (renamed from src/com/gitblit/wicket/LogoutPage.java)2
-rw-r--r--src/com/gitblit/wicket/pages/MarkdownPage.java1
-rw-r--r--src/com/gitblit/wicket/pages/PatchPage.java3
-rw-r--r--src/com/gitblit/wicket/pages/RepositoriesPage.java1
-rw-r--r--src/com/gitblit/wicket/pages/RepositoryPage.html (renamed from src/com/gitblit/wicket/RepositoryPage.html)0
-rw-r--r--src/com/gitblit/wicket/pages/RepositoryPage.java (renamed from src/com/gitblit/wicket/RepositoryPage.java)16
-rw-r--r--src/com/gitblit/wicket/pages/SearchPage.java1
-rw-r--r--src/com/gitblit/wicket/pages/SummaryPage.java3
-rw-r--r--src/com/gitblit/wicket/pages/TagPage.java5
-rw-r--r--src/com/gitblit/wicket/pages/TagsPage.java1
-rw-r--r--src/com/gitblit/wicket/pages/TicketPage.java5
-rw-r--r--src/com/gitblit/wicket/pages/TicketsPage.java5
-rw-r--r--src/com/gitblit/wicket/pages/TreePage.java5
-rw-r--r--src/com/gitblit/wicket/panels/BranchesPanel.java5
-rw-r--r--src/com/gitblit/wicket/panels/CommitHeaderPanel.java1
-rw-r--r--src/com/gitblit/wicket/panels/CommitLegendPanel.java2
-rw-r--r--src/com/gitblit/wicket/panels/HistoryPanel.java5
-rw-r--r--src/com/gitblit/wicket/panels/LinkPanel.html (renamed from src/com/gitblit/wicket/LinkPanel.html)0
-rw-r--r--src/com/gitblit/wicket/panels/LinkPanel.java (renamed from src/com/gitblit/wicket/LinkPanel.java)2
-rw-r--r--src/com/gitblit/wicket/panels/LogPanel.java1
-rw-r--r--src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java15
-rw-r--r--src/com/gitblit/wicket/panels/RefsPanel.java1
-rw-r--r--src/com/gitblit/wicket/panels/RepositoriesPanel.java5
-rw-r--r--src/com/gitblit/wicket/panels/SearchPanel.java1
-rw-r--r--src/com/gitblit/wicket/panels/TagsPanel.java3
-rw-r--r--src/com/gitblit/wicket/panels/UsersPanel.java1
62 files changed, 327 insertions, 320 deletions
diff --git a/src/com/gitblit/Build.java b/src/com/gitblit/Build.java
index da0c3e03..a6d5bb02 100644
--- a/src/com/gitblit/Build.java
+++ b/src/com/gitblit/Build.java
@@ -80,7 +80,7 @@ public class Build {
downloadFromApache(MavenObject.MARKDOWNPAPERS, BuildType.COMPILETIME);
downloadFromApache(MavenObject.BOUNCYCASTLE, BuildType.COMPILETIME);
downloadFromApache(MavenObject.BOUNCYCASTLE_MAIL, BuildType.COMPILETIME);
-
+
downloadFromApache(MavenObject.JSCH, BuildType.RUNTIME);
downloadFromApache(MavenObject.JSCH, BuildType.COMPILETIME);
@@ -389,10 +389,9 @@ public class Build {
"384058ca906dffb8b8708c2db8849c9754359b28",
"7b026658ed8de2eccc2d11d647d43d7c84a56911",
"6c19e37b3caafd70c1b7b024ae1858c725181688");
-
- public static final MavenObject JSCH = new MavenObject("JSch", "com/jcraft",
- "jsch", "0.1.44-1", 214000, 211000, 413000,
- "2e9ae08de5a71bd0e0d3ba2558598181bfa71d4e",
+
+ public static final MavenObject JSCH = new MavenObject("JSch", "com/jcraft", "jsch",
+ "0.1.44-1", 214000, 211000, 413000, "2e9ae08de5a71bd0e0d3ba2558598181bfa71d4e",
"e528f593b19b04d500992606f58b87fcfded8883",
"d0ffadd0a4ab909d94a577b5aad43c13b617ddcb");
diff --git a/src/com/gitblit/BuildSite.java b/src/com/gitblit/BuildSite.java
index f3a1a9f1..890cec1e 100644
--- a/src/com/gitblit/BuildSite.java
+++ b/src/com/gitblit/BuildSite.java
@@ -37,6 +37,7 @@ import com.beust.jcommander.Parameter;
import com.beust.jcommander.ParameterException;
import com.beust.jcommander.Parameters;
import com.gitblit.utils.MarkdownUtils;
+import com.gitblit.utils.StringUtils;
public class BuildSite {
@@ -83,8 +84,8 @@ public class BuildSite {
sb.setLength(sb.length() - 3);
sb.trimToSize();
- String htmlHeader = readContent(new File(params.pageHeader));
- String htmlFooter = readContent(new File(params.pageFooter));
+ String htmlHeader = readContent(new File(params.pageHeader), "\n");
+ String htmlFooter = readContent(new File(params.pageFooter), "\n");
final String links = sb.toString();
final String header = MessageFormat.format(htmlHeader, Constants.FULL_NAME, links);
final String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
@@ -101,6 +102,13 @@ public class BuildSite {
String[] kv = token.split("=");
content = content.replace(kv[0], kv[1]);
}
+ for (String alias : params.loads) {
+ String[] kv = alias.split("=");
+ String loadedContent = readContent(new File(kv[1]), "\n");
+ loadedContent = StringUtils.escapeForHtml(loadedContent, false);
+ loadedContent = StringUtils.breakLinesForHtml(loadedContent);
+ content = content.replace(kv[0], loadedContent);
+ }
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(new File(
destinationFolder, fileName)), Charset.forName("UTF-8"));
writer.write(header);
@@ -115,7 +123,7 @@ public class BuildSite {
}
}
- private static String readContent(File file) {
+ private static String readContent(File file, String lineEnding) {
StringBuilder sb = new StringBuilder();
try {
InputStreamReader is = new InputStreamReader(new FileInputStream(file),
@@ -124,6 +132,9 @@ public class BuildSite {
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line);
+ if (lineEnding != null) {
+ sb.append(lineEnding);
+ }
}
reader.close();
} catch (Throwable t) {
@@ -171,8 +182,11 @@ public class BuildSite {
@Parameter(names = { "--alias" }, description = "Filename=Linkname aliases", required = false)
public List<String> aliases = new ArrayList<String>();
- @Parameter(names = { "--substitute" }, description = "@TOKEN@=value", required = false)
+ @Parameter(names = { "--substitute" }, description = "%TOKEN%=value", required = false)
public List<String> substitutions = new ArrayList<String>();
+ @Parameter(names = { "--load" }, description = "%TOKEN%=filename", required = false)
+ public List<String> loads = new ArrayList<String>();
+
}
}
diff --git a/src/com/gitblit/Constants.java b/src/com/gitblit/Constants.java
index b6741820..3589f491 100644
--- a/src/com/gitblit/Constants.java
+++ b/src/com/gitblit/Constants.java
@@ -37,6 +37,8 @@ public class Constants {
public static final String ZIP_SERVLET_PATH = "/zip/";
+ public static final String BORDER = "***********************************************************";
+
public static enum AccessRestrictionType {
NONE, PUSH, CLONE, VIEW;
diff --git a/src/com/gitblit/DownloadZipServlet.java b/src/com/gitblit/DownloadZipServlet.java
index 3bbf2253..86ca4e77 100644
--- a/src/com/gitblit/DownloadZipServlet.java
+++ b/src/com/gitblit/DownloadZipServlet.java
@@ -26,9 +26,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.gitblit.Constants.AccessRestrictionType;
+import com.gitblit.models.RepositoryModel;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
-import com.gitblit.wicket.models.RepositoryModel;
public class DownloadZipServlet extends HttpServlet {
diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java
index 9dd3a9e5..52dd9dbb 100644
--- a/src/com/gitblit/GitBlit.java
+++ b/src/com/gitblit/GitBlit.java
@@ -35,10 +35,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.gitblit.Constants.AccessRestrictionType;
+import com.gitblit.models.RepositoryModel;
+import com.gitblit.models.UserModel;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
-import com.gitblit.wicket.models.RepositoryModel;
-import com.gitblit.wicket.models.UserModel;
public class GitBlit implements ServletContextListener {
@@ -151,8 +151,8 @@ public class GitBlit implements ServletContextListener {
r = repositoryResolver.open(null, repositoryName);
} catch (RepositoryNotFoundException e) {
r = null;
- logger.error("GitBlit.getRepository(String) failed to find repository "
- + repositoryName);
+ logger.error("GitBlit.getRepository(String) failed to find "
+ + new File(repositoriesFolder, repositoryName).getAbsolutePath());
} catch (ServiceNotEnabledException e) {
r = null;
e.printStackTrace();
@@ -186,6 +186,9 @@ public class GitBlit implements ServletContextListener {
public RepositoryModel getRepositoryModel(String repositoryName) {
Repository r = getRepository(repositoryName);
+ if (r == null) {
+ return null;
+ }
RepositoryModel model = new RepositoryModel();
model.name = repositoryName;
model.hasCommits = JGitUtils.hasCommits(r);
@@ -315,7 +318,7 @@ public class GitBlit implements ServletContextListener {
}
public void configureContext(IStoredSettings settings) {
- logger.info("Using configuration from " + settings.toString());
+ logger.info("Reading configuration from " + settings.toString());
this.storedSettings = settings;
repositoriesFolder = new File(settings.getString(Keys.git.repositoriesFolder, "repos"));
exportAll = settings.getBoolean(Keys.git.exportAll, true);
diff --git a/src/com/gitblit/GitBlitServer.java b/src/com/gitblit/GitBlitServer.java
index c8731572..416c47ad 100644
--- a/src/com/gitblit/GitBlitServer.java
+++ b/src/com/gitblit/GitBlitServer.java
@@ -65,12 +65,8 @@ import com.gitblit.wicket.GitBlitWebApp;
public class GitBlitServer {
- private static final String BORDER = "***********************************************************";
-
private static Logger logger;
- private static final FileSettings FILESETTINGS = new FileSettings();
-
public static void main(String[] args) {
Params params = new Params();
JCommander jc = new JCommander(params);
@@ -91,9 +87,9 @@ public class GitBlitServer {
}
private static void usage(JCommander jc, ParameterException t) {
- System.out.println(BORDER);
+ System.out.println(Constants.BORDER);
System.out.println(Constants.getGitBlitVersion());
- System.out.println(BORDER);
+ System.out.println(Constants.BORDER);
System.out.println();
if (t != null) {
System.out.println(t.getMessage());
@@ -129,18 +125,19 @@ public class GitBlitServer {
* Start Server.
*/
private static void start(Params params) {
- String pattern = FILESETTINGS.getString(Keys.server.log4jPattern,
+ FileSettings settings = params.FILESETTINGS;
+ String pattern = settings.getString(Keys.server.log4jPattern,
"%-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n");
// allow os override of logging pattern
String os = System.getProperty("os.name").toLowerCase();
if (os.indexOf("windows") > -1) {
- String winPattern = FILESETTINGS.getString(Keys.server.log4jPattern_windows, pattern);
+ String winPattern = settings.getString(Keys.server.log4jPattern_windows, pattern);
if (!StringUtils.isEmpty(winPattern)) {
pattern = winPattern;
}
} else if (os.indexOf("linux") > -1) {
- String linuxPattern = FILESETTINGS.getString(Keys.server.log4jPattern_linux, pattern);
+ String linuxPattern = settings.getString(Keys.server.log4jPattern_linux, pattern);
if (!StringUtils.isEmpty(linuxPattern)) {
pattern = linuxPattern;
}
@@ -151,9 +148,9 @@ public class GitBlitServer {
rootLogger.addAppender(new ConsoleAppender(layout));
logger = LoggerFactory.getLogger(GitBlitServer.class);
- logger.info(BORDER);
+ logger.info(Constants.BORDER);
logger.info(Constants.getGitBlitVersion());
- logger.info(BORDER);
+ logger.info(Constants.BORDER);
String osname = System.getProperty("os.name");
String osversion = System.getProperty("os.version");
@@ -163,7 +160,7 @@ public class GitBlitServer {
List<Connector> connectors = new ArrayList<Connector>();
if (params.port > 0) {
Connector httpConnector = createConnector(params.useNIO, params.port);
- String bindInterface = FILESETTINGS.getString(Keys.server.httpBindInterface, null);
+ String bindInterface = settings.getString(Keys.server.httpBindInterface, null);
if (!StringUtils.isEmpty(bindInterface)) {
logger.warn(MessageFormat.format("Binding connector on port {0} to {1}",
params.port, bindInterface));
@@ -182,7 +179,7 @@ public class GitBlitServer {
if (keystore.exists()) {
Connector secureConnector = createSSLConnector(keystore, params.storePassword,
params.useNIO, params.securePort);
- String bindInterface = FILESETTINGS.getString(Keys.server.httpsBindInterface, null);
+ String bindInterface = settings.getString(Keys.server.httpsBindInterface, null);
if (!StringUtils.isEmpty(bindInterface)) {
logger.warn(MessageFormat.format("Binding ssl connector on port {0} to {1}",
params.securePort, bindInterface));
@@ -246,11 +243,11 @@ public class GitBlitServer {
// Git Servlet
ServletHolder gitServlet = null;
String gitServletPathSpec = Constants.GIT_SERVLET_PATH + "*";
- if (FILESETTINGS.getBoolean(Keys.git.enableGitServlet, true)) {
+ if (settings.getBoolean(Keys.git.enableGitServlet, true)) {
gitServlet = rootContext.addServlet(GitBlitServlet.class, gitServletPathSpec);
gitServlet.setInitParameter("base-path", params.repositoriesFolder);
gitServlet.setInitParameter("export-all",
- FILESETTINGS.getBoolean(Keys.git.exportAll, true) ? "1" : "0");
+ settings.getBoolean(Keys.git.exportAll, true) ? "1" : "0");
}
// Login Service
@@ -300,12 +297,14 @@ public class GitBlitServer {
handler = rootContext;
}
+ logger.info("Git repositories folder " + new File(params.repositoriesFolder).getAbsolutePath());
+
// Set the server's contexts
server.setHandler(handler);
// Setup the GitBlit context
GitBlit gitblit = GitBlit.self();
- gitblit.configureContext(FILESETTINGS);
+ gitblit.configureContext(settings);
rootContext.addEventListener(gitblit);
// Start the Server
@@ -385,6 +384,8 @@ public class GitBlitServer {
private final ServerSocket socket;
private final Server server;
+
+ private final Logger logger = LoggerFactory.getLogger(ShutdownMonitorThread.class);
public ShutdownMonitorThread(Server server, Params params) {
this.server = server;
@@ -408,9 +409,9 @@ public class GitBlitServer {
BufferedReader reader = new BufferedReader(new InputStreamReader(
accept.getInputStream()));
reader.readLine();
- logger.info(BORDER);
+ logger.info(Constants.BORDER);
logger.info("Stopping " + Constants.NAME);
- logger.info(BORDER);
+ logger.info(Constants.BORDER);
server.stop();
server.setStopAtShutdown(false);
accept.close();
@@ -423,6 +424,8 @@ public class GitBlitServer {
@Parameters(separators = " ")
private static class Params {
+
+ private static final FileSettings FILESETTINGS = new FileSettings();
/*
* Server parameters
diff --git a/src/com/gitblit/GitBlitServlet.java b/src/com/gitblit/GitBlitServlet.java
index 91bd7b26..46868846 100644
--- a/src/com/gitblit/GitBlitServlet.java
+++ b/src/com/gitblit/GitBlitServlet.java
@@ -27,7 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.gitblit.Constants.AccessRestrictionType;
-import com.gitblit.wicket.models.RepositoryModel;
+import com.gitblit.models.RepositoryModel;
public class GitBlitServlet extends GitServlet {
diff --git a/src/com/gitblit/ILoginService.java b/src/com/gitblit/ILoginService.java
index 155595bb..d7bfd017 100644
--- a/src/com/gitblit/ILoginService.java
+++ b/src/com/gitblit/ILoginService.java
@@ -17,7 +17,7 @@ package com.gitblit;
import java.util.List;
-import com.gitblit.wicket.models.UserModel;
+import com.gitblit.models.UserModel;
public interface ILoginService {
diff --git a/src/com/gitblit/JettyLoginService.java b/src/com/gitblit/JettyLoginService.java
index ac7dd799..63a98618 100644
--- a/src/com/gitblit/JettyLoginService.java
+++ b/src/com/gitblit/JettyLoginService.java
@@ -38,7 +38,7 @@ import org.eclipse.jetty.util.log.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.gitblit.wicket.models.UserModel;
+import com.gitblit.models.UserModel;
public class JettyLoginService extends MappedLoginService implements ILoginService {
diff --git a/src/com/gitblit/MakeCertificate.java b/src/com/gitblit/MakeCertificate.java
index eafb98a4..67b2fd90 100644
--- a/src/com/gitblit/MakeCertificate.java
+++ b/src/com/gitblit/MakeCertificate.java
@@ -44,9 +44,7 @@ import com.beust.jcommander.Parameters;
import com.gitblit.utils.TimeUtils;
public class MakeCertificate {
-
- private static final FileSettings FILESETTINGS = new FileSettings();
-
+
private static final String BC = org.bouncycastle.jce.provider.BouncyCastleProvider.PROVIDER_NAME;
public static void main(String... args) {
@@ -158,6 +156,8 @@ public class MakeCertificate {
@Parameters(separators = " ")
private static class Params {
+ private static final FileSettings FILESETTINGS = new FileSettings();
+
@Parameter(names = { "--alias" }, description = "Server alias", required = true)
public String alias;
diff --git a/src/com/gitblit/wicket/models/Metric.java b/src/com/gitblit/models/Metric.java
index 3014cd0c..9ff270ad 100644
--- a/src/com/gitblit/wicket/models/Metric.java
+++ b/src/com/gitblit/models/Metric.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gitblit.wicket.models;
+package com.gitblit.models;
import java.io.Serializable;
diff --git a/src/com/gitblit/wicket/models/PathModel.java b/src/com/gitblit/models/PathModel.java
index 2edc96c9..17a7971e 100644
--- a/src/com/gitblit/wicket/models/PathModel.java
+++ b/src/com/gitblit/models/PathModel.java
@@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gitblit.wicket.models;
+package com.gitblit.models;
import java.io.Serializable;
import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-
-import com.gitblit.utils.JGitUtils;
+import org.eclipse.jgit.lib.FileMode;
public class PathModel implements Serializable, Comparable<PathModel> {
@@ -41,7 +40,7 @@ public class PathModel implements Serializable, Comparable<PathModel> {
}
public boolean isTree() {
- return JGitUtils.isTreeFromMode(mode);
+ return FileMode.TREE.equals(mode);
}
public static PathModel getParentPath(String basePath, String commitId) {
diff --git a/src/com/gitblit/wicket/models/RefModel.java b/src/com/gitblit/models/RefModel.java
index e0831f5a..b33c8ba7 100644
--- a/src/com/gitblit/wicket/models/RefModel.java
+++ b/src/com/gitblit/models/RefModel.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gitblit.wicket.models;
+package com.gitblit.models;
import java.io.Serializable;
import java.util.Date;
@@ -22,8 +22,6 @@ import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.revwalk.RevCommit;
-import com.gitblit.utils.JGitUtils;
-
public class RefModel implements Serializable, Comparable<RefModel> {
private static final long serialVersionUID = 1L;
@@ -38,7 +36,7 @@ public class RefModel implements Serializable, Comparable<RefModel> {
}
public Date getDate() {
- return JGitUtils.getCommitDate(commit);
+ return new Date(commit.getCommitTime() * 1000L);
}
public String getName() {
diff --git a/src/com/gitblit/wicket/models/RepositoryModel.java b/src/com/gitblit/models/RepositoryModel.java
index 575e64a5..7241d76b 100644
--- a/src/com/gitblit/wicket/models/RepositoryModel.java
+++ b/src/com/gitblit/models/RepositoryModel.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gitblit.wicket.models;
+package com.gitblit.models;
import java.io.Serializable;
import java.util.Date;
@@ -23,7 +23,7 @@ import com.gitblit.Constants.AccessRestrictionType;
public class RepositoryModel implements Serializable {
private static final long serialVersionUID = 1L;
-
+
// field names are reflectively mapped in EditRepository page
public String name;
public String description;
diff --git a/src/com/gitblit/wicket/models/TicketModel.java b/src/com/gitblit/models/TicketModel.java
index b661c19a..b284340a 100644
--- a/src/com/gitblit/wicket/models/TicketModel.java
+++ b/src/com/gitblit/models/TicketModel.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gitblit.wicket.models;
+package com.gitblit.models;
import java.io.Serializable;
import java.text.ParseException;
@@ -37,12 +37,6 @@ public class TicketModel implements Serializable, Comparable<TicketModel> {
public List<Comment> comments;
public List<String> tags;
- public TicketModel() {
- state = "open";
- comments = new ArrayList<Comment>();
- tags = new ArrayList<String>();
- }
-
public TicketModel(String ticketName) throws ParseException {
state = "";
name = ticketName;
diff --git a/src/com/gitblit/wicket/models/UserModel.java b/src/com/gitblit/models/UserModel.java
index 1181ee15..797c14e2 100644
--- a/src/com/gitblit/wicket/models/UserModel.java
+++ b/src/com/gitblit/models/UserModel.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gitblit.wicket.models;
+package com.gitblit.models;
import java.io.Serializable;
import java.util.ArrayList;
diff --git a/src/com/gitblit/utils/DiffUtils.java b/src/com/gitblit/utils/DiffUtils.java
new file mode 100644
index 00000000..d7a4a632
--- /dev/null
+++ b/src/com/gitblit/utils/DiffUtils.java
@@ -0,0 +1,149 @@
+package com.gitblit.utils;
+
+import java.io.ByteArrayOutputStream;
+import java.util.List;
+
+import org.eclipse.jgit.diff.DiffEntry;
+import org.eclipse.jgit.diff.DiffFormatter;
+import org.eclipse.jgit.diff.RawTextComparator;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.revwalk.RevTree;
+import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.jgit.treewalk.TreeWalk;
+import org.eclipse.jgit.treewalk.filter.TreeFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.gitblit.utils.JGitUtils.DiffOutputType;
+
+public class DiffUtils {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(DiffUtils.class);
+
+ public static String getCommitDiff(Repository r, RevCommit commit, DiffOutputType outputType) {
+ return getCommitDiff(r, null, commit, null, outputType);
+ }
+
+ public static String getCommitDiff(Repository r, RevCommit commit, String path,
+ DiffOutputType outputType) {
+ return getCommitDiff(r, null, commit, path, outputType);
+ }
+
+ public static String getCommitDiff(Repository r, RevCommit baseCommit, RevCommit commit,
+ DiffOutputType outputType) {
+ return getCommitDiff(r, baseCommit, commit, null, outputType);
+ }
+
+ public static String getCommitDiff(Repository r, RevCommit baseCommit, RevCommit commit,
+ String path, DiffOutputType outputType) {
+ try {
+ RevTree baseTree;
+ if (baseCommit == null) {
+ final RevWalk rw = new RevWalk(r);
+ RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
+ rw.dispose();
+ baseTree = parent.getTree();
+ } else {
+ baseTree = baseCommit.getTree();
+ }
+
+ RevTree commitTree = commit.getTree();
+
+ final TreeWalk walk = new TreeWalk(r);
+ walk.reset();
+ walk.setRecursive(true);
+ walk.addTree(baseTree);
+ walk.addTree(commitTree);
+ walk.setFilter(TreeFilter.ANY_DIFF);
+
+ final ByteArrayOutputStream os = new ByteArrayOutputStream();
+ RawTextComparator cmp = RawTextComparator.DEFAULT;
+ DiffFormatter df;
+ switch (outputType) {
+ case GITWEB:
+ df = new GitWebDiffFormatter(os);
+ break;
+ case GITBLIT:
+ df = new GitBlitDiffFormatter(os);
+ break;
+ case PLAIN:
+ default:
+ df = new DiffFormatter(os);
+ break;
+ }
+ df.setRepository(r);
+ df.setDiffComparator(cmp);
+ df.setDetectRenames(true);
+ List<DiffEntry> diffs = df.scan(baseTree, commitTree);
+ if (path != null && path.length() > 0) {
+ for (DiffEntry diff : diffs) {
+ if (diff.getNewPath().equalsIgnoreCase(path)) {
+ df.format(diff);
+ break;
+ }
+ }
+ } else {
+ df.format(diffs);
+ }
+ String diff;
+ if (df instanceof GitWebDiffFormatter) {
+ // workaround for complex private methods in DiffFormatter
+ diff = ((GitWebDiffFormatter) df).getHtml();
+ } else {
+ diff = os.toString();
+ }
+ df.flush();
+ return diff;
+ } catch (Throwable t) {
+ LOGGER.error("failed to generate commit diff!", t);
+ }
+ return null;
+ }
+
+ public static String getCommitPatch(Repository r, RevCommit baseCommit, RevCommit commit,
+ String path) {
+ try {
+ RevTree baseTree;
+ if (baseCommit == null) {
+ final RevWalk rw = new RevWalk(r);
+ RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
+ baseTree = parent.getTree();
+ } else {
+ baseTree = baseCommit.getTree();
+ }
+ RevTree commitTree = commit.getTree();
+
+ final TreeWalk walk = new TreeWalk(r);
+ walk.reset();
+ walk.setRecursive(true);
+ walk.addTree(baseTree);
+ walk.addTree(commitTree);
+ walk.setFilter(TreeFilter.ANY_DIFF);
+
+ final ByteArrayOutputStream os = new ByteArrayOutputStream();
+ RawTextComparator cmp = RawTextComparator.DEFAULT;
+ PatchFormatter df = new PatchFormatter(os);
+ df.setRepository(r);
+ df.setDiffComparator(cmp);
+ df.setDetectRenames(true);
+ List<DiffEntry> diffs = df.scan(baseTree, commitTree);
+ if (path != null && path.length() > 0) {
+ for (DiffEntry diff : diffs) {
+ if (diff.getNewPath().equalsIgnoreCase(path)) {
+ df.format(diff);
+ break;
+ }
+ }
+ } else {
+ df.format(diffs);
+ }
+ String diff = df.getPatch(commit);
+ df.flush();
+ return diff;
+ } catch (Throwable t) {
+ LOGGER.error("failed to generate commit diff!", t);
+ }
+ return null;
+ }
+}
diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java
index 088cd00e..f99fbfdd 100644
--- a/src/com/gitblit/utils/JGitUtils.java
+++ b/src/com/gitblit/utils/JGitUtils.java
@@ -73,12 +73,12 @@ import org.eclipse.jgit.util.io.DisabledOutputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.gitblit.wicket.models.Metric;
-import com.gitblit.wicket.models.PathModel;
-import com.gitblit.wicket.models.PathModel.PathChangeModel;
-import com.gitblit.wicket.models.RefModel;
-import com.gitblit.wicket.models.TicketModel;
-import com.gitblit.wicket.models.TicketModel.Comment;
+import com.gitblit.models.Metric;
+import com.gitblit.models.PathModel;
+import com.gitblit.models.RefModel;
+import com.gitblit.models.TicketModel;
+import com.gitblit.models.PathModel.PathChangeModel;
+import com.gitblit.models.TicketModel.Comment;
public class JGitUtils {
@@ -183,11 +183,18 @@ public class JGitUtils {
}
public static boolean hasCommits(Repository r) {
- return new File(r.getDirectory(), Constants.R_HEADS).list().length > 0;
+ if (r != null && r.getDirectory().exists()) {
+ return new File(r.getDirectory(), Constants.R_HEADS).list().length > 0;
+ }
+ return false;
}
public static Date getLastChange(Repository r) {
if (!hasCommits(r)) {
+ // null repository
+ if (r == null) {
+ return new Date(0);
+ }
// fresh repository
return new Date(r.getDirectory().lastModified());
}
@@ -460,132 +467,6 @@ public class JGitUtils {
}
}
- public static String getCommitDiff(Repository r, RevCommit commit, DiffOutputType outputType) {
- return getCommitDiff(r, null, commit, null, outputType);
- }
-
- public static String getCommitDiff(Repository r, RevCommit commit, String path,
- DiffOutputType outputType) {
- return getCommitDiff(r, null, commit, path, outputType);
- }
-
- public static String getCommitDiff(Repository r, RevCommit baseCommit, RevCommit commit,
- DiffOutputType outputType) {
- return getCommitDiff(r, baseCommit, commit, null, outputType);
- }
-
- public static String getCommitDiff(Repository r, RevCommit baseCommit, RevCommit commit,
- String path, DiffOutputType outputType) {
- try {
- RevTree baseTree;
- if (baseCommit == null) {
- final RevWalk rw = new RevWalk(r);
- RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
- rw.dispose();
- baseTree = parent.getTree();
- } else {
- baseTree = baseCommit.getTree();
- }
-
- RevTree commitTree = commit.getTree();
-
- final TreeWalk walk = new TreeWalk(r);
- walk.reset();
- walk.setRecursive(true);
- walk.addTree(baseTree);
- walk.addTree(commitTree);
- walk.setFilter(TreeFilter.ANY_DIFF);
-
- final ByteArrayOutputStream os = new ByteArrayOutputStream();
- RawTextComparator cmp = RawTextComparator.DEFAULT;
- DiffFormatter df;
- switch (outputType) {
- case GITWEB:
- df = new GitWebDiffFormatter(os);
- break;
- case GITBLIT:
- df = new GitBlitDiffFormatter(os);
- break;
- case PLAIN:
- default:
- df = new DiffFormatter(os);
- break;
- }
- df.setRepository(r);
- df.setDiffComparator(cmp);
- df.setDetectRenames(true);
- List<DiffEntry> diffs = df.scan(baseTree, commitTree);
- if (path != null && path.length() > 0) {
- for (DiffEntry diff : diffs) {
- if (diff.getNewPath().equalsIgnoreCase(path)) {
- df.format(diff);
- break;
- }
- }
- } else {
- df.format(diffs);
- }
- String diff;
- if (df instanceof GitWebDiffFormatter) {
- // workaround for complex private methods in DiffFormatter
- diff = ((GitWebDiffFormatter) df).getHtml();
- } else {
- diff = os.toString();
- }
- df.flush();
- return diff;
- } catch (Throwable t) {
- LOGGER.error("failed to generate commit diff!", t);
- }
- return null;
- }
-
- public static String getCommitPatch(Repository r, RevCommit baseCommit, RevCommit commit,
- String path) {
- try {
- RevTree baseTree;
- if (baseCommit == null) {
- final RevWalk rw = new RevWalk(r);
- RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
- baseTree = parent.getTree();
- } else {
- baseTree = baseCommit.getTree();
- }
- RevTree commitTree = commit.getTree();
-
- final TreeWalk walk = new TreeWalk(r);
- walk.reset();
- walk.setRecursive(true);
- walk.addTree(baseTree);
- walk.addTree(commitTree);
- walk.setFilter(TreeFilter.ANY_DIFF);
-
- final ByteArrayOutputStream os = new ByteArrayOutputStream();
- RawTextComparator cmp = RawTextComparator.DEFAULT;
- PatchFormatter df = new PatchFormatter(os);
- df.setRepository(r);
- df.setDiffComparator(cmp);
- df.setDetectRenames(true);
- List<DiffEntry> diffs = df.scan(baseTree, commitTree);
- if (path != null && path.length() > 0) {
- for (DiffEntry diff : diffs) {
- if (diff.getNewPath().equalsIgnoreCase(path)) {
- df.format(diff);
- break;
- }
- }
- } else {
- df.format(diffs);
- }
- String diff = df.getPatch(commit);
- df.flush();
- return diff;
- } catch (Throwable t) {
- LOGGER.error("failed to generate commit diff!", t);
- }
- return null;
- }
-
private static PathModel getPathModel(TreeWalk walk, String basePath, RevCommit commit) {
String name;
long size = 0;
diff --git a/src/com/gitblit/wicket/AuthorizationStrategy.java b/src/com/gitblit/wicket/AuthorizationStrategy.java
index 42d25225..b6b745bd 100644
--- a/src/com/gitblit/wicket/AuthorizationStrategy.java
+++ b/src/com/gitblit/wicket/AuthorizationStrategy.java
@@ -22,7 +22,9 @@ import org.apache.wicket.authorization.strategies.page.AbstractPageAuthorization
import com.gitblit.GitBlit;
import com.gitblit.Keys;
-import com.gitblit.wicket.models.UserModel;
+import com.gitblit.models.UserModel;
+import com.gitblit.wicket.pages.BasePage;
+import com.gitblit.wicket.pages.LoginPage;
import com.gitblit.wicket.pages.RepositoriesPage;
public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy implements
@@ -46,7 +48,7 @@ public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy imp
}
UserModel user = session.getUser();
- if (pageClass.isAnnotationPresent(AdminPage.class)) {
+ if (pageClass.isAnnotationPresent(RequiresAdminRole.class)) {
// admin page
if (allowAdmin) {
if (authenticateAdmin) {
diff --git a/src/com/gitblit/wicket/GitBlitWebApp.java b/src/com/gitblit/wicket/GitBlitWebApp.java
index f78bb0da..1d251d9c 100644
--- a/src/com/gitblit/wicket/GitBlitWebApp.java
+++ b/src/com/gitblit/wicket/GitBlitWebApp.java
@@ -34,6 +34,8 @@ import com.gitblit.wicket.pages.CommitPage;
import com.gitblit.wicket.pages.DocsPage;
import com.gitblit.wicket.pages.HistoryPage;
import com.gitblit.wicket.pages.LogPage;
+import com.gitblit.wicket.pages.LoginPage;
+import com.gitblit.wicket.pages.LogoutPage;
import com.gitblit.wicket.pages.MarkdownPage;
import com.gitblit.wicket.pages.PatchPage;
import com.gitblit.wicket.pages.RawPage;
diff --git a/src/com/gitblit/wicket/GitBlitWebSession.java b/src/com/gitblit/wicket/GitBlitWebSession.java
index 6488695d..2238660f 100644
--- a/src/com/gitblit/wicket/GitBlitWebSession.java
+++ b/src/com/gitblit/wicket/GitBlitWebSession.java
@@ -22,7 +22,7 @@ import org.apache.wicket.Session;
import org.apache.wicket.protocol.http.WebSession;
import org.apache.wicket.protocol.http.request.WebClientInfo;
-import com.gitblit.wicket.models.UserModel;
+import com.gitblit.models.UserModel;
public final class GitBlitWebSession extends WebSession {
diff --git a/src/com/gitblit/wicket/AdminPage.java b/src/com/gitblit/wicket/RequiresAdminRole.java
index 1c9e0ef5..ce2dcfcf 100644
--- a/src/com/gitblit/wicket/AdminPage.java
+++ b/src/com/gitblit/wicket/RequiresAdminRole.java
@@ -22,5 +22,5 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
-public @interface AdminPage {
+public @interface RequiresAdminRole {
}
diff --git a/src/com/gitblit/wicket/BasePage.html b/src/com/gitblit/wicket/pages/BasePage.html
index 0e8705c6..0da37d40 100644
--- a/src/com/gitblit/wicket/BasePage.html
+++ b/src/com/gitblit/wicket/pages/BasePage.html
@@ -8,8 +8,8 @@
<wicket:head>
<title wicket:id="title">[page title]</title>
<wicket:link>
- <link rel="stylesheet" type="text/css" href="resources/gitblit.css"/>
- <link rel="shortcut icon" href="resources/gitblt-favicon.png" type="image/png" />
+ <link rel="stylesheet" type="text/css" href="/com/gitblit/wicket/resources/gitblit.css"/>
+ <link rel="shortcut icon" href="/com/gitblit/wicket/resources/gitblt-favicon.png" type="image/png" />
</wicket:link>
</wicket:head>
@@ -18,7 +18,7 @@
<div class="page_header">
<a title="gitblit homepage" href="http://gitblit.com/">
<wicket:link>
- <img src="resources/gitblt_25.png" width="79" height="25" alt="gitblit" class="logo"/>
+ <img src="/com/gitblit/wicket/resources/gitblt_25.png" width="79" height="25" alt="gitblit" class="logo"/>
</wicket:link>
</a>
<span>
diff --git a/src/com/gitblit/wicket/BasePage.java b/src/com/gitblit/wicket/pages/BasePage.java
index 2e4adfe3..9031befd 100644
--- a/src/com/gitblit/wicket/BasePage.java
+++ b/src/com/gitblit/wicket/pages/BasePage.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gitblit.wicket;
+package com.gitblit.wicket.pages;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -34,7 +34,9 @@ import com.gitblit.Constants;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
-import com.gitblit.wicket.pages.SummaryPage;
+import com.gitblit.wicket.GitBlitWebSession;
+import com.gitblit.wicket.WicketUtils;
+import com.gitblit.wicket.panels.LinkPanel;
public abstract class BasePage extends WebPage {
diff --git a/src/com/gitblit/wicket/pages/BlobDiffPage.java b/src/com/gitblit/wicket/pages/BlobDiffPage.java
index aae41ba4..4bd61d5c 100644
--- a/src/com/gitblit/wicket/pages/BlobDiffPage.java
+++ b/src/com/gitblit/wicket/pages/BlobDiffPage.java
@@ -23,10 +23,10 @@ import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
+import com.gitblit.utils.DiffUtils;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.JGitUtils.DiffOutputType;
import com.gitblit.utils.StringUtils;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.CommitHeaderPanel;
import com.gitblit.wicket.panels.PathBreadcrumbsPanel;
@@ -48,13 +48,13 @@ public class BlobDiffPage extends RepositoryPage {
String diff;
if (StringUtils.isEmpty(baseObjectId)) {
// use first parent
- diff = JGitUtils.getCommitDiff(r, commit, blobPath, diffType);
+ diff = DiffUtils.getCommitDiff(r, commit, blobPath, diffType);
add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
} else {
// base commit specified
RevCommit baseCommit = JGitUtils.getCommit(r, baseObjectId);
- diff = JGitUtils.getCommitDiff(r, baseCommit, commit, blobPath, diffType);
+ diff = DiffUtils.getCommitDiff(r, baseCommit, commit, blobPath, diffType);
add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
WicketUtils.newBlobDiffParameter(repositoryName, baseObjectId, objectId,
blobPath)));
diff --git a/src/com/gitblit/wicket/pages/BlobPage.java b/src/com/gitblit/wicket/pages/BlobPage.java
index 23244c0a..4601ac7b 100644
--- a/src/com/gitblit/wicket/pages/BlobPage.java
+++ b/src/com/gitblit/wicket/pages/BlobPage.java
@@ -29,7 +29,6 @@ import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
import com.gitblit.utils.JGitUtils;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.CommitHeaderPanel;
import com.gitblit.wicket.panels.PathBreadcrumbsPanel;
diff --git a/src/com/gitblit/wicket/pages/BranchesPage.java b/src/com/gitblit/wicket/pages/BranchesPage.java
index f348fd4a..2b7d5187 100644
--- a/src/com/gitblit/wicket/pages/BranchesPage.java
+++ b/src/com/gitblit/wicket/pages/BranchesPage.java
@@ -17,7 +17,6 @@ package com.gitblit.wicket.pages;
import org.apache.wicket.PageParameters;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.panels.BranchesPanel;
public class BranchesPage extends RepositoryPage {
diff --git a/src/com/gitblit/wicket/pages/CommitDiffPage.java b/src/com/gitblit/wicket/pages/CommitDiffPage.java
index 81ee520a..1f492aca 100644
--- a/src/com/gitblit/wicket/pages/CommitDiffPage.java
+++ b/src/com/gitblit/wicket/pages/CommitDiffPage.java
@@ -29,14 +29,14 @@ import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
+import com.gitblit.models.PathModel.PathChangeModel;
+import com.gitblit.utils.DiffUtils;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.JGitUtils.DiffOutputType;
-import com.gitblit.wicket.LinkPanel;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.PathModel.PathChangeModel;
import com.gitblit.wicket.panels.CommitHeaderPanel;
import com.gitblit.wicket.panels.CommitLegendPanel;
+import com.gitblit.wicket.panels.LinkPanel;
public class CommitDiffPage extends RepositoryPage {
@@ -47,7 +47,7 @@ public class CommitDiffPage extends RepositoryPage {
RevCommit commit = getCommit();
DiffOutputType diffType = DiffOutputType.forName(GitBlit.getString(Keys.web.diffStyle,
DiffOutputType.GITBLIT.name()));
- String diff = JGitUtils.getCommitDiff(r, commit, diffType);
+ String diff = DiffUtils.getCommitDiff(r, commit, diffType);
List<String> parents = new ArrayList<String>();
if (commit.getParentCount() > 0) {
diff --git a/src/com/gitblit/wicket/pages/CommitPage.java b/src/com/gitblit/wicket/pages/CommitPage.java
index 1a8f7c3c..dc674a2e 100644
--- a/src/com/gitblit/wicket/pages/CommitPage.java
+++ b/src/com/gitblit/wicket/pages/CommitPage.java
@@ -32,14 +32,13 @@ import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.DownloadZipServlet;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
+import com.gitblit.models.PathModel.PathChangeModel;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.JGitUtils.SearchType;
-import com.gitblit.wicket.LinkPanel;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.PathModel.PathChangeModel;
import com.gitblit.wicket.panels.CommitHeaderPanel;
import com.gitblit.wicket.panels.CommitLegendPanel;
+import com.gitblit.wicket.panels.LinkPanel;
public class CommitPage extends RepositoryPage {
diff --git a/src/com/gitblit/wicket/pages/DocsPage.java b/src/com/gitblit/wicket/pages/DocsPage.java
index 32b208a8..7f41b71b 100644
--- a/src/com/gitblit/wicket/pages/DocsPage.java
+++ b/src/com/gitblit/wicket/pages/DocsPage.java
@@ -27,12 +27,11 @@ import org.eclipse.jgit.lib.Repository;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
+import com.gitblit.models.PathModel;
import com.gitblit.utils.ByteFormat;
import com.gitblit.utils.JGitUtils;
-import com.gitblit.wicket.LinkPanel;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.PathModel;
+import com.gitblit.wicket.panels.LinkPanel;
public class DocsPage extends RepositoryPage {
diff --git a/src/com/gitblit/wicket/pages/EditRepositoryPage.java b/src/com/gitblit/wicket/pages/EditRepositoryPage.java
index 2b5cb999..a1a42d00 100644
--- a/src/com/gitblit/wicket/pages/EditRepositoryPage.java
+++ b/src/com/gitblit/wicket/pages/EditRepositoryPage.java
@@ -40,12 +40,11 @@ import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.GitBlit;
import com.gitblit.GitBlitException;
import com.gitblit.Keys;
+import com.gitblit.models.RepositoryModel;
+import com.gitblit.models.UserModel;
import com.gitblit.utils.StringUtils;
-import com.gitblit.wicket.BasePage;
import com.gitblit.wicket.GitBlitWebSession;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.RepositoryModel;
-import com.gitblit.wicket.models.UserModel;
public class EditRepositoryPage extends BasePage {
@@ -57,7 +56,7 @@ public class EditRepositoryPage extends BasePage {
// create constructor
super();
isCreate = true;
- setupPage(new RepositoryModel("", "", "", new Date()));
+ setupPage(new RepositoryModel());
}
public EditRepositoryPage(PageParameters params) {
diff --git a/src/com/gitblit/wicket/pages/EditUserPage.java b/src/com/gitblit/wicket/pages/EditUserPage.java
index 1127ffb7..fb647f78 100644
--- a/src/com/gitblit/wicket/pages/EditUserPage.java
+++ b/src/com/gitblit/wicket/pages/EditUserPage.java
@@ -38,14 +38,13 @@ import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.GitBlit;
import com.gitblit.GitBlitException;
import com.gitblit.Keys;
+import com.gitblit.models.RepositoryModel;
+import com.gitblit.models.UserModel;
import com.gitblit.utils.StringUtils;
-import com.gitblit.wicket.AdminPage;
-import com.gitblit.wicket.BasePage;
+import com.gitblit.wicket.RequiresAdminRole;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.RepositoryModel;
-import com.gitblit.wicket.models.UserModel;
-@AdminPage
+@RequiresAdminRole
public class EditUserPage extends BasePage {
private final boolean isCreate;
diff --git a/src/com/gitblit/wicket/pages/HistoryPage.java b/src/com/gitblit/wicket/pages/HistoryPage.java
index e4f8f8d0..122eeb8a 100644
--- a/src/com/gitblit/wicket/pages/HistoryPage.java
+++ b/src/com/gitblit/wicket/pages/HistoryPage.java
@@ -18,7 +18,6 @@ package com.gitblit.wicket.pages;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.HistoryPanel;
diff --git a/src/com/gitblit/wicket/pages/LogPage.java b/src/com/gitblit/wicket/pages/LogPage.java
index 2554f7d6..35f8a73f 100644
--- a/src/com/gitblit/wicket/pages/LogPage.java
+++ b/src/com/gitblit/wicket/pages/LogPage.java
@@ -18,7 +18,6 @@ package com.gitblit.wicket.pages;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.LogPanel;
diff --git a/src/com/gitblit/wicket/LoginPage.html b/src/com/gitblit/wicket/pages/LoginPage.html
index 037063cc..280453d5 100644
--- a/src/com/gitblit/wicket/LoginPage.html
+++ b/src/com/gitblit/wicket/pages/LoginPage.html
@@ -8,8 +8,8 @@
<wicket:head>
<title wicket:id="title">[page title]</title>
<wicket:link>
- <link rel="stylesheet" type="text/css" href="resources/gitblit.css"/>
- <link rel="shortcut icon" href="resources/gitblt-favicon.png" type="image/png" />
+ <link rel="stylesheet" type="text/css" href="/com/gitblit/wicket/resources/gitblit.css"/>
+ <link rel="shortcut icon" href="/com/gitblit/wicket/resources/gitblt-favicon.png" type="image/png" />
</wicket:link>
</wicket:head>
@@ -17,7 +17,7 @@
<div>
<div style="padding-top: 10px;text-align:center;">
<wicket:link>
- <img src="resources/gitblt_25.png" alt="Git:Blit"/><br/>
+ <img src="/com/gitblit/wicket/resources/gitblt_25.png" alt="Git:Blit"/><br/>
</wicket:link>
<div style="padding-top:30px;font-weight:bold;" wicket:id="name">[name]</div>
</div>
diff --git a/src/com/gitblit/wicket/LoginPage.java b/src/com/gitblit/wicket/pages/LoginPage.java
index 87108787..56e979ce 100644
--- a/src/com/gitblit/wicket/LoginPage.java
+++ b/src/com/gitblit/wicket/pages/LoginPage.java
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gitblit.wicket;
+package com.gitblit.wicket.pages;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.PasswordTextField;
import org.apache.wicket.markup.html.form.StatelessForm;
import org.apache.wicket.markup.html.form.TextField;
@@ -29,7 +28,8 @@ import org.apache.wicket.model.Model;
import com.gitblit.Constants;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
-import com.gitblit.wicket.models.UserModel;
+import com.gitblit.models.UserModel;
+import com.gitblit.wicket.GitBlitWebSession;
public class LoginPage extends WebPage {
@@ -39,44 +39,39 @@ public class LoginPage extends WebPage {
public LoginPage(PageParameters params) {
super(params);
+ // If we are already logged in because user directly accessed
+ // the login url, redirect to the home page
+ if (GitBlitWebSession.get().isLoggedIn()) {
+ setRedirect(true);
+ setResponsePage(getApplication().getHomePage());
+ }
+
add(new Label("title", GitBlit.getString(Keys.web.siteName, Constants.NAME)));
add(new Label("name", Constants.NAME));
- Form<Void> loginForm = new LoginForm("loginForm");
+ StatelessForm<Void> loginForm = new StatelessForm<Void>("loginForm") {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void onSubmit() {
+ String username = LoginPage.this.username.getObject();
+ char[] password = LoginPage.this.password.getObject().toCharArray();
+
+ UserModel user = GitBlit.self().authenticate(username, password);
+ if (user == null) {
+ error("Invalid username or password!");
+ } else {
+ loginUser(user);
+ }
+ }
+ };
loginForm.add(new TextField<String>("username", username));
loginForm.add(new PasswordTextField("password", password));
loginForm.add(new FeedbackPanel("feedback"));
add(loginForm);
}
- class LoginForm extends StatelessForm<Void> {
- private static final long serialVersionUID = 1L;
-
- public LoginForm(String id) {
- super(id);
-
- // If we are already logged in because user directly accessed
- // the login url, redirect to the home page
- if (GitBlitWebSession.get().isLoggedIn()) {
- setRedirect(true);
- setResponsePage(getApplication().getHomePage());
- }
- }
-
- @Override
- public void onSubmit() {
- String username = LoginPage.this.username.getObject();
- char[] password = LoginPage.this.password.getObject().toCharArray();
-
- UserModel user = GitBlit.self().authenticate(username, password);
- if (user == null) {
- error("Invalid username or password!");
- } else {
- loginUser(user);
- }
- }
- }
-
private void loginUser(UserModel user) {
if (user != null) {
// Set the user into the session
diff --git a/src/com/gitblit/wicket/LogoutPage.java b/src/com/gitblit/wicket/pages/LogoutPage.java
index 47f80f0c..05beab3c 100644
--- a/src/com/gitblit/wicket/LogoutPage.java
+++ b/src/com/gitblit/wicket/pages/LogoutPage.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gitblit.wicket;
+package com.gitblit.wicket.pages;
import org.apache.wicket.markup.html.WebPage;
diff --git a/src/com/gitblit/wicket/pages/MarkdownPage.java b/src/com/gitblit/wicket/pages/MarkdownPage.java
index d62c4330..fc8b7cbc 100644
--- a/src/com/gitblit/wicket/pages/MarkdownPage.java
+++ b/src/com/gitblit/wicket/pages/MarkdownPage.java
@@ -26,7 +26,6 @@ import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.MarkdownUtils;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
public class MarkdownPage extends RepositoryPage {
diff --git a/src/com/gitblit/wicket/pages/PatchPage.java b/src/com/gitblit/wicket/pages/PatchPage.java
index 02e4d386..04934735 100644
--- a/src/com/gitblit/wicket/pages/PatchPage.java
+++ b/src/com/gitblit/wicket/pages/PatchPage.java
@@ -22,6 +22,7 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.GitBlit;
+import com.gitblit.utils.DiffUtils;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
import com.gitblit.wicket.GitBlitWebSession;
@@ -61,7 +62,7 @@ public class PatchPage extends WebPage {
if (!StringUtils.isEmpty(baseObjectId)) {
baseCommit = JGitUtils.getCommit(r, baseObjectId);
}
- String patch = JGitUtils.getCommitPatch(r, baseCommit, commit, blobPath);
+ String patch = DiffUtils.getCommitPatch(r, baseCommit, commit, blobPath);
add(new Label("patchText", patch));
r.close();
}
diff --git a/src/com/gitblit/wicket/pages/RepositoriesPage.java b/src/com/gitblit/wicket/pages/RepositoriesPage.java
index 2bb818da..b0e5e579 100644
--- a/src/com/gitblit/wicket/pages/RepositoriesPage.java
+++ b/src/com/gitblit/wicket/pages/RepositoriesPage.java
@@ -28,7 +28,6 @@ import com.gitblit.GitBlit;
import com.gitblit.Keys;
import com.gitblit.utils.MarkdownUtils;
import com.gitblit.utils.StringUtils;
-import com.gitblit.wicket.BasePage;
import com.gitblit.wicket.GitBlitWebSession;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.RepositoriesPanel;
diff --git a/src/com/gitblit/wicket/RepositoryPage.html b/src/com/gitblit/wicket/pages/RepositoryPage.html
index 0e0ce476..0e0ce476 100644
--- a/src/com/gitblit/wicket/RepositoryPage.html
+++ b/src/com/gitblit/wicket/pages/RepositoryPage.html
diff --git a/src/com/gitblit/wicket/RepositoryPage.java b/src/com/gitblit/wicket/pages/RepositoryPage.java
index 9d5253f0..109c51a8 100644
--- a/src/com/gitblit/wicket/RepositoryPage.java
+++ b/src/com/gitblit/wicket/pages/RepositoryPage.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gitblit.wicket;
+package com.gitblit.wicket.pages;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -45,19 +45,13 @@ import org.slf4j.LoggerFactory;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
+import com.gitblit.models.RepositoryModel;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.JGitUtils.SearchType;
import com.gitblit.utils.StringUtils;
-import com.gitblit.wicket.models.RepositoryModel;
-import com.gitblit.wicket.pages.BranchesPage;
-import com.gitblit.wicket.pages.DocsPage;
-import com.gitblit.wicket.pages.EditRepositoryPage;
-import com.gitblit.wicket.pages.LogPage;
-import com.gitblit.wicket.pages.SearchPage;
-import com.gitblit.wicket.pages.SummaryPage;
-import com.gitblit.wicket.pages.TagsPage;
-import com.gitblit.wicket.pages.TicketsPage;
-import com.gitblit.wicket.pages.TreePage;
+import com.gitblit.wicket.GitBlitWebSession;
+import com.gitblit.wicket.WicketUtils;
+import com.gitblit.wicket.panels.LinkPanel;
import com.gitblit.wicket.panels.RefsPanel;
public abstract class RepositoryPage extends BasePage {
diff --git a/src/com/gitblit/wicket/pages/SearchPage.java b/src/com/gitblit/wicket/pages/SearchPage.java
index b12beee3..335c40d7 100644
--- a/src/com/gitblit/wicket/pages/SearchPage.java
+++ b/src/com/gitblit/wicket/pages/SearchPage.java
@@ -19,7 +19,6 @@ import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import com.gitblit.utils.JGitUtils.SearchType;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.SearchPanel;
diff --git a/src/com/gitblit/wicket/pages/SummaryPage.java b/src/com/gitblit/wicket/pages/SummaryPage.java
index 835b344a..181de0da 100644
--- a/src/com/gitblit/wicket/pages/SummaryPage.java
+++ b/src/com/gitblit/wicket/pages/SummaryPage.java
@@ -42,12 +42,11 @@ import com.gitblit.Constants;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
+import com.gitblit.models.Metric;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
import com.gitblit.utils.TimeUtils;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.Metric;
import com.gitblit.wicket.panels.BranchesPanel;
import com.gitblit.wicket.panels.LogPanel;
import com.gitblit.wicket.panels.TagsPanel;
diff --git a/src/com/gitblit/wicket/pages/TagPage.java b/src/com/gitblit/wicket/pages/TagPage.java
index ff02b7bc..7945231d 100644
--- a/src/com/gitblit/wicket/pages/TagPage.java
+++ b/src/com/gitblit/wicket/pages/TagPage.java
@@ -21,12 +21,11 @@ import org.apache.wicket.PageParameters;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
+import com.gitblit.models.RefModel;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.JGitUtils.SearchType;
-import com.gitblit.wicket.LinkPanel;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.RefModel;
+import com.gitblit.wicket.panels.LinkPanel;
public class TagPage extends RepositoryPage {
diff --git a/src/com/gitblit/wicket/pages/TagsPage.java b/src/com/gitblit/wicket/pages/TagsPage.java
index 0f429425..3ddbde9b 100644
--- a/src/com/gitblit/wicket/pages/TagsPage.java
+++ b/src/com/gitblit/wicket/pages/TagsPage.java
@@ -17,7 +17,6 @@ package com.gitblit.wicket.pages;
import org.apache.wicket.PageParameters;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.panels.TagsPanel;
public class TagsPage extends RepositoryPage {
diff --git a/src/com/gitblit/wicket/pages/TicketPage.java b/src/com/gitblit/wicket/pages/TicketPage.java
index 9c8c3926..353c543e 100644
--- a/src/com/gitblit/wicket/pages/TicketPage.java
+++ b/src/com/gitblit/wicket/pages/TicketPage.java
@@ -22,13 +22,12 @@ import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.markup.repeater.data.ListDataProvider;
import org.eclipse.jgit.lib.Repository;
+import com.gitblit.models.TicketModel;
+import com.gitblit.models.TicketModel.Comment;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
import com.gitblit.wicket.GitBlitWebSession;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.TicketModel;
-import com.gitblit.wicket.models.TicketModel.Comment;
public class TicketPage extends RepositoryPage {
diff --git a/src/com/gitblit/wicket/pages/TicketsPage.java b/src/com/gitblit/wicket/pages/TicketsPage.java
index 2832385c..8da4e942 100644
--- a/src/com/gitblit/wicket/pages/TicketsPage.java
+++ b/src/com/gitblit/wicket/pages/TicketsPage.java
@@ -23,13 +23,12 @@ import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.markup.repeater.data.ListDataProvider;
+import com.gitblit.models.TicketModel;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
import com.gitblit.wicket.GitBlitWebSession;
-import com.gitblit.wicket.LinkPanel;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.TicketModel;
+import com.gitblit.wicket.panels.LinkPanel;
public class TicketsPage extends RepositoryPage {
diff --git a/src/com/gitblit/wicket/pages/TreePage.java b/src/com/gitblit/wicket/pages/TreePage.java
index 761b82e0..4fc7119a 100644
--- a/src/com/gitblit/wicket/pages/TreePage.java
+++ b/src/com/gitblit/wicket/pages/TreePage.java
@@ -32,13 +32,12 @@ import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.DownloadZipServlet;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
+import com.gitblit.models.PathModel;
import com.gitblit.utils.ByteFormat;
import com.gitblit.utils.JGitUtils;
-import com.gitblit.wicket.LinkPanel;
-import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.PathModel;
import com.gitblit.wicket.panels.CommitHeaderPanel;
+import com.gitblit.wicket.panels.LinkPanel;
import com.gitblit.wicket.panels.PathBreadcrumbsPanel;
public class TreePage extends RepositoryPage {
diff --git a/src/com/gitblit/wicket/panels/BranchesPanel.java b/src/com/gitblit/wicket/panels/BranchesPanel.java
index 357c7c2c..d50db883 100644
--- a/src/com/gitblit/wicket/panels/BranchesPanel.java
+++ b/src/com/gitblit/wicket/panels/BranchesPanel.java
@@ -28,12 +28,11 @@ import org.apache.wicket.model.StringResourceModel;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
+import com.gitblit.models.RefModel;
+import com.gitblit.models.RepositoryModel;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
-import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.RefModel;
-import com.gitblit.wicket.models.RepositoryModel;
import com.gitblit.wicket.pages.BranchesPage;
import com.gitblit.wicket.pages.LogPage;
import com.gitblit.wicket.pages.SummaryPage;
diff --git a/src/com/gitblit/wicket/panels/CommitHeaderPanel.java b/src/com/gitblit/wicket/panels/CommitHeaderPanel.java
index cb80321a..1a6580d6 100644
--- a/src/com/gitblit/wicket/panels/CommitHeaderPanel.java
+++ b/src/com/gitblit/wicket/panels/CommitHeaderPanel.java
@@ -18,7 +18,6 @@ package com.gitblit.wicket.panels;
import org.apache.wicket.markup.html.basic.Label;
import org.eclipse.jgit.revwalk.RevCommit;
-import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.pages.CommitPage;
diff --git a/src/com/gitblit/wicket/panels/CommitLegendPanel.java b/src/com/gitblit/wicket/panels/CommitLegendPanel.java
index ee81c695..bbfa1855 100644
--- a/src/com/gitblit/wicket/panels/CommitLegendPanel.java
+++ b/src/com/gitblit/wicket/panels/CommitLegendPanel.java
@@ -28,9 +28,9 @@ import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.markup.repeater.data.ListDataProvider;
import org.eclipse.jgit.diff.DiffEntry.ChangeType;
+import com.gitblit.models.PathModel.PathChangeModel;
import com.gitblit.utils.JGitUtils;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.PathModel.PathChangeModel;
public class CommitLegendPanel extends Panel {
diff --git a/src/com/gitblit/wicket/panels/HistoryPanel.java b/src/com/gitblit/wicket/panels/HistoryPanel.java
index d65b02c7..180a248a 100644
--- a/src/com/gitblit/wicket/panels/HistoryPanel.java
+++ b/src/com/gitblit/wicket/panels/HistoryPanel.java
@@ -32,13 +32,12 @@ import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
+import com.gitblit.models.PathModel;
+import com.gitblit.models.PathModel.PathChangeModel;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.JGitUtils.SearchType;
import com.gitblit.utils.StringUtils;
-import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.PathModel;
-import com.gitblit.wicket.models.PathModel.PathChangeModel;
import com.gitblit.wicket.pages.BlobDiffPage;
import com.gitblit.wicket.pages.BlobPage;
import com.gitblit.wicket.pages.CommitDiffPage;
diff --git a/src/com/gitblit/wicket/LinkPanel.html b/src/com/gitblit/wicket/panels/LinkPanel.html
index e7e9ff5f..e7e9ff5f 100644
--- a/src/com/gitblit/wicket/LinkPanel.html
+++ b/src/com/gitblit/wicket/panels/LinkPanel.html
diff --git a/src/com/gitblit/wicket/LinkPanel.java b/src/com/gitblit/wicket/panels/LinkPanel.java
index 2700cf86..475a71ef 100644
--- a/src/com/gitblit/wicket/LinkPanel.java
+++ b/src/com/gitblit/wicket/panels/LinkPanel.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gitblit.wicket;
+package com.gitblit.wicket.panels;
import org.apache.wicket.PageParameters;
import org.apache.wicket.behavior.SimpleAttributeModifier;
diff --git a/src/com/gitblit/wicket/panels/LogPanel.java b/src/com/gitblit/wicket/panels/LogPanel.java
index b321917c..c5ccac43 100644
--- a/src/com/gitblit/wicket/panels/LogPanel.java
+++ b/src/com/gitblit/wicket/panels/LogPanel.java
@@ -34,7 +34,6 @@ import com.gitblit.Keys;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.JGitUtils.SearchType;
import com.gitblit.utils.StringUtils;
-import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.pages.CommitDiffPage;
import com.gitblit.wicket.pages.CommitPage;
diff --git a/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java b/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java
index 2693cc2b..bc98e25c 100644
--- a/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java
+++ b/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java
@@ -25,7 +25,6 @@ import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.markup.repeater.data.ListDataProvider;
-import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.pages.TreePage;
@@ -59,7 +58,10 @@ public class PathBreadcrumbsPanel extends Panel {
public void populateItem(final Item<BreadCrumb> item) {
final BreadCrumb entry = item.getModelObject();
- String path = entry.getPath();
+ String path = entry.path;
+ if (path.equals(ROOT)) {
+ path = null;
+ }
if (entry.isLeaf) {
item.add(new Label("pathLink", entry.name));
item.add(new Label("pathSeparator", "").setVisible(false));
@@ -85,13 +87,6 @@ public class PathBreadcrumbsPanel extends Panel {
this.name = name;
this.path = path;
this.isLeaf = isLeaf;
- }
-
- String getPath() {
- if (path.equals(ROOT)) {
- return null;
- }
- return path;
- }
+ }
}
} \ No newline at end of file
diff --git a/src/com/gitblit/wicket/panels/RefsPanel.java b/src/com/gitblit/wicket/panels/RefsPanel.java
index b6e4b0bb..33b1884f 100644
--- a/src/com/gitblit/wicket/panels/RefsPanel.java
+++ b/src/com/gitblit/wicket/panels/RefsPanel.java
@@ -29,7 +29,6 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.revwalk.RevCommit;
-import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.pages.CommitPage;
import com.gitblit.wicket.pages.LogPage;
diff --git a/src/com/gitblit/wicket/panels/RepositoriesPanel.java b/src/com/gitblit/wicket/panels/RepositoriesPanel.java
index a566b595..a0c9e132 100644
--- a/src/com/gitblit/wicket/panels/RepositoriesPanel.java
+++ b/src/com/gitblit/wicket/panels/RepositoriesPanel.java
@@ -43,13 +43,12 @@ import org.apache.wicket.model.Model;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
+import com.gitblit.models.RepositoryModel;
+import com.gitblit.models.UserModel;
import com.gitblit.utils.StringUtils;
import com.gitblit.utils.TimeUtils;
import com.gitblit.wicket.GitBlitWebSession;
-import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.RepositoryModel;
-import com.gitblit.wicket.models.UserModel;
import com.gitblit.wicket.pages.EditRepositoryPage;
import com.gitblit.wicket.pages.SummaryPage;
diff --git a/src/com/gitblit/wicket/panels/SearchPanel.java b/src/com/gitblit/wicket/panels/SearchPanel.java
index 8c63c423..f91e0e8a 100644
--- a/src/com/gitblit/wicket/panels/SearchPanel.java
+++ b/src/com/gitblit/wicket/panels/SearchPanel.java
@@ -32,7 +32,6 @@ import com.gitblit.Keys;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.JGitUtils.SearchType;
import com.gitblit.utils.StringUtils;
-import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.pages.CommitDiffPage;
import com.gitblit.wicket.pages.CommitPage;
diff --git a/src/com/gitblit/wicket/panels/TagsPanel.java b/src/com/gitblit/wicket/panels/TagsPanel.java
index 1d8eec7d..de8112a4 100644
--- a/src/com/gitblit/wicket/panels/TagsPanel.java
+++ b/src/com/gitblit/wicket/panels/TagsPanel.java
@@ -26,11 +26,10 @@ import org.apache.wicket.markup.repeater.data.ListDataProvider;
import org.apache.wicket.model.StringResourceModel;
import org.eclipse.jgit.lib.Repository;
+import com.gitblit.models.RefModel;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
-import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.RefModel;
import com.gitblit.wicket.pages.CommitPage;
import com.gitblit.wicket.pages.LogPage;
import com.gitblit.wicket.pages.SummaryPage;
diff --git a/src/com/gitblit/wicket/panels/UsersPanel.java b/src/com/gitblit/wicket/panels/UsersPanel.java
index 27bc334b..4cf92a46 100644
--- a/src/com/gitblit/wicket/panels/UsersPanel.java
+++ b/src/com/gitblit/wicket/panels/UsersPanel.java
@@ -26,7 +26,6 @@ import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.markup.repeater.data.ListDataProvider;
import com.gitblit.GitBlit;
-import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.pages.EditUserPage;