summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2011-05-27 23:37:24 -0400
committerJames Moger <james.moger@gitblit.com>2011-05-27 23:37:24 -0400
commit1f9daef870a8c7a984955166a542628d69012ed5 (patch)
tree93972413a5affb9ae3096c7c15ae7b411b08b1ff
parent17c417dad5c7be28df4b6e1fd25ec56b484faaff (diff)
downloadgitblit-1f9daef870a8c7a984955166a542628d69012ed5.tar.gz
gitblit-1f9daef870a8c7a984955166a542628d69012ed5.zip
Codepro analyze dependencies. Documentation.
-rw-r--r--README.MKD25
-rw-r--r--build.xml19
-rw-r--r--distrib/gitblit.properties52
-rw-r--r--docs/00_index.mkd11
-rw-r--r--docs/00_setup.mkd23
-rw-r--r--docs/01_eclipse.mkd18
-rw-r--r--docs/01_faq.mkd43
-rw-r--r--docs/02_properties.mkd4
-rw-r--r--docs/page_header.html6
-rw-r--r--docs/sslverify.pngbin48728 -> 0 bytes
-rw-r--r--docs/sslverify2.pngbin21758 -> 0 bytes
-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
-rw-r--r--tests/com/gitblit/tests/GitBlitSuite.java2
-rw-r--r--tests/com/gitblit/tests/JGitUtilsTest.java9
75 files changed, 468 insertions, 391 deletions
diff --git a/README.MKD b/README.MKD
index 719f40df..2a94730f 100644
--- a/README.MKD
+++ b/README.MKD
@@ -1,18 +1,9 @@
Gitblit
=================
-Gitblit is an open source, pure Java Git solution.
-
-Gitblit can be found at: http://gitblit.com and is licensed under
-the Apache Software Foundation license, version 2.0.
-
-Contents
---------
- - License
- - Java/Application server requirements
- - Getting help
- - Building Gitblit
-
+Gitblit is an open source, pure Java Git solution for creating, viewing, and serving [Git](http://git-scm.com) repositories.<br/>
+More information about Gitblit can be found [here](http://gitblit.com).
+
License
-------
@@ -28,8 +19,7 @@ Gitblit requires at least Java 1.6.
Getting help
------------
- - Read the online documentation available on the Gitblit website
- (http://gitblit.com)
+Read the online documentation available at the [Gitblit website](http://gitblit.com)
Building Gitblit
----------------
@@ -40,7 +30,6 @@ Building Gitblit
2. Using Ant, execute the `build.xml` script in the project root.<br/>
*This will download all necessary build dependencies and will also generate the Keys class for accessing settings.*
3. Select your gitblit project root and **Refresh** the project, this should correct all build problems.
-4. Review the settings in `gitblit.properties` in your project root.<br/>
-Make sure you set an appropriate value for *git.repositoriesFolder*.
-5. Execute the *com.gitblit.Launcher* class to start Gitblit.
- \ No newline at end of file
+4. Using JUnit, execute the `com.gitblit.tests.GitBlitSuite` test suite.<br/>
+*This will clone some repositories from the web and run through the unit tests.*
+5. Execute the *com.gitblit.Launcher* class to start Gitblit. \ No newline at end of file
diff --git a/build.xml b/build.xml
index 2c8a24ae..4b279101 100644
--- a/build.xml
+++ b/build.xml
@@ -25,7 +25,7 @@
<replacestring from="&quot;;" to="" />
<trim />
</tokenfilter>
- </filterchain>
+ </filterchain>
</loadfile>
<!-- extract JGit version number from source code -->
@@ -154,6 +154,14 @@
</fileset>
</copy>
+ <!-- Copy google-code-prettify -->
+ <mkdir dir="${basedir}/src/com/gitblit/wicket/pages/prettify" />
+ <copy todir="${basedir}/site/prettify">
+ <fileset dir="${basedir}/src/com/gitblit/wicket/pages/prettify">
+ <exclude name="thumbs.db" />
+ </fileset>
+ </copy>
+
<!-- Copy screenshot thumbnails -->
<mkdir dir="${basedir}/site/thumbs" />
<copy todir="${basedir}/site/thumbs">
@@ -187,6 +195,9 @@
<arg value="--alias" />
<arg value="index=overview" />
+
+ <arg value="--alias" />
+ <arg value="properties=gitblit.properties" />
<arg value="--substitute" />
<arg value="%VERSION%=${gb.version}" />
@@ -199,9 +210,13 @@
<arg value="--substitute" />
<arg value="%JGIT%=${jgit.version}" />
+
+ <arg value="--load" />
+ <arg value="%PROPERTIES%=${basedir}/distrib/gitblit.properties" />
+
</java>
- <!-- Cleanup -->
+ <!-- Cleanup -->
<delete dir="${project.build.dir}" />
</target>
</project>
diff --git a/distrib/gitblit.properties b/distrib/gitblit.properties
index 4e2965fd..c17674ab 100644
--- a/distrib/gitblit.properties
+++ b/distrib/gitblit.properties
@@ -3,18 +3,22 @@
#
# Allow push/pull over http/https with JGit servlet
+# Changing this value requires a server restart.
git.enableGitServlet = true
# Base folder for repositories
+# Changing this value requires a server restart.
# Use forward slashes even on Windows!!
+# e.g. c:/gitrepos
git.repositoriesFolder = git
# Export all repositories
+# Changing this value requires a server restart.
# if false, each exported repository must have a .git/git-daemon-export-ok file
git.exportAll = true
# Search repositories folder for nested repositories
-# e.g. /libraries/mylibrary.git
+# e.g. c:/gitrepos/libraries/mylibrary.git
git.nestedRepositories = true
#
@@ -22,12 +26,15 @@ git.nestedRepositories = true
#
# Require authentication to see everything but the admin pages
+# Changing this value requires a server restart.
web.authenticateViewPages = false
# Require admin authentication for the admin functions and pages
+# Changing this value requires a server restart.
web.authenticateAdminPages = true
# Simple user realm file to authenticate users
+# Changing this value requires a server restart.
realm.realmFile = users.properties
# How to store passwords.
@@ -44,10 +51,11 @@ realm.minPasswordLength = 5
# If blank Gitblit is displayed.
web.siteName =
-# If web.authenticate=true, users with "admin" role can create repositories,
-# create users, and edit repository metadata (owner, description, etc)
+# If web.authenticateAdminPages=true, users with "admin" role can create
+# repositories, create users, and edit repository metadata.
#
-# If web.authenticate=false, any user can execute the aforementioned functions.
+# If web.authenticateAdminPages=false, any user can execute the aforementioned
+# functions.
web.allowAdministration = true
# Allow dyanamic zip downloads.
@@ -60,20 +68,23 @@ web.repositoriesMessage = gitblit
# Use the client timezone when formatting dates.
# This uses AJAX to determine the browser's timezone.
+# Changing this value requires a server restart.
web.useClientTimezone = false
# Date and Time formats
+# http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
web.datestampShortFormat = yyyy-MM-dd
web.datetimestampLongFormat = EEEE, MMMM d, yyyy h:mm a z
# Show other URLs on the summary page for accessing your git repositories
# Use spaces to separate urls. {0} is the token for the repository name.
+# e.g.
# web.otherUrls = ssh://localhost/git/{0} git://localhost/git/{0}
web.otherUrls =
# Choose how to present the repositories list.
-# grouped = group nested/subfolder repositories together (no sorting)
-# flat = flat list of repositories (sorting allowed)
+# grouped = group nested/subfolder repositories together (no sorting)
+# flat = flat list of repositories (sorting allowed)
web.repositoryListType = grouped
# If using a grouped repository list and there are repositories at the
@@ -92,7 +103,7 @@ web.showEmailAddresses = true
web.showSearchTypeSelection = false
# Generates a line graph of repository activity over time on the Summary page.
-# This is a real-time graph so generation may be expensive.
+# This uses the Google Charts API.
web.generateActivityGraph = true
# The number of commits to display on the summary page
@@ -108,22 +119,27 @@ web.summaryRefsCount = 5
web.itemsPerPage = 50
# Registered extensions for google-code-prettify
+# (case-insensitive)
web.prettyPrintExtensions = c cpp cs css htm html java js php pl prefs properties py rb sh sql xml vb
# Registered extensions for markdown transformation
-web.markdownExtensions = md mkd markdown
+# (CASE-SENSITIVE)
+web.markdownExtensions = md mkd markdown MD MKD
# Image extensions
+# (case-insensitive)
web.imageExtensions = bmp jpg gif png
# Registered extensions for binary blobs
+# (case-insensitive)
web.binaryExtensions = jar pdf tar.gz zip
# Aggressive heap management will run the garbage collector on every generated
-# page. This slows down page generation but improves heap consumption.
+# page. This slows down page generation a little but improves heap consumption.
web.aggressiveHeapManagement = true
# Run the webapp in debug mode
+# Changing this value requires a server restart.
web.debugMode = false
# Enable/disable global regex substitutions (i.e. shared across repositories)
@@ -141,9 +157,21 @@ regex.global = true
#
# Server Settings
#
+# Changing any of these values requires a server restart.
+
+# The temporary folder to decompress the gitblit webapp.
server.tempFolder = temp
+
+# The common log4j logging pattern
+# http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
server.log4jPattern = %-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n
+
+# Alternatively, you may specify a logging pattern for your OS.
+# If the os pattern is blank, the common pattern is used.
+
+# This windows pattern fits (mostly) within the fixed bounds of a command prompt.
server.log4jPattern.windows = %-5p %m%n
+
server.log4jPattern.linux =
@@ -162,13 +190,13 @@ server.httpsPort = 443
# Specify the interface for Jetty to bind the standard connector.
# You may specify an ip or an empty value to bind to all interfaces.
-# Specifying localhost will result in Git:Blit ONLY listening to requests to
+# Specifying localhost will result in Gitblit ONLY listening to requests to
# localhost.
server.httpBindInterface = localhost
# Specify the interface for Jetty to bind the secure connector.
# You may specify an ip or an empty value to bind to all interfaces.
-# Specifying localhost will result in Git:Blit ONLY listening to requests to
+# Specifying localhost will result in Gitblit ONLY listening to requests to
# localhost.
server.httpsBindInterface = localhost
@@ -176,7 +204,7 @@ server.httpsBindInterface = localhost
# Keystore password and certificate password must match.
# This is provided for convenience, its probably more secure to set this value
# using the --storePassword command line parameter.
-server.storePassword = dosomegit
+server.storePassword = gitblit
# Port for shutdown monitor to listen on.
server.shutdownPort = 8081
diff --git a/docs/00_index.mkd b/docs/00_index.mkd
index e21a158b..9ad1c4e8 100644
--- a/docs/00_index.mkd
+++ b/docs/00_index.mkd
@@ -107,10 +107,10 @@ The following dependencies are automatically downloaded from the Apache Maven re
- [JSch - Java Secure Channel](http://www.jcraft.com/jsch) (BSD)
- [JUnit](http://junit.org) (Common Public License)
-## Building
+## Building from Source
[Eclipse](http://eclipse.org) is recommended for development as the project settings are preconfigured.
-Additionally, [Google CodePro AnalytiX](http://code.google.com/javadevtools), [eclipse-cs](http://eclipse-cs.sourceforge.net), and [FindBugs](http://findbugs.sourceforge.net) are recommended development tools.
+Additionally, [Google CodePro AnalytiX](http://code.google.com/javadevtools), [eclipse-cs](http://eclipse-cs.sourceforge.net), [FindBugs](http://findbugs.sourceforge.net), and [EclEmma](http://www.eclemma.org) are recommended development tools.
1. Clone the git repository from [Github][gitbltsrc].
2. Import the gitblit project into your Eclipse workspace.<br/>
@@ -118,8 +118,11 @@ Additionally, [Google CodePro AnalytiX](http://code.google.com/javadevtools), [e
3. Using Ant, execute the `build.xml` script in the project root.<br/>
*This will download all necessary build dependencies and will also generate the Keys class for accessing settings.*
4. Select your gitblit project root and **Refresh** the project, this should correct all build problems.
-5. Review the settings in `gitblit.properties` in your project root.<br/>
-Make sure you set an appropriate value for *git.repositoriesFolder*.
+5. Using JUnit, execute the `com.gitblit.tests.GitBlitSuite` test suite.<br/>
+*This will clone some repositories from the web and run through the unit tests.*
+5. Review the settings in `gitblit.properties` in your project root.
+ - By default, the *git.repositoriesFolder* points to the repositories cloned by the test suite.<br/>
+ - If running on Linux you may have to change the served port(s) to > 1024 unless you are developing as the root user.
6. Execute the *com.gitblit.Launcher* class to start Gitblit.
[jgit]: http://eclipse.org/jgit "Eclipse JGit Site"
diff --git a/docs/00_setup.mkd b/docs/00_setup.mkd
index 447f1515..99fd05fc 100644
--- a/docs/00_setup.mkd
+++ b/docs/00_setup.mkd
@@ -1,4 +1,4 @@
-## Setup and Configuration
+## Server Setup and Configuration
1. Download and unzip [Gitblit %VERSION%](http://gitblit.com/%DISTRIBUTION%).<br/>
*Its best to eliminate spaces in the path name as that can cause troubleshooting headaches.*
@@ -74,4 +74,23 @@ Set the *JVM* variable in the script to the location of your Java Virtual Machin
**Example**
- java -jar gitblit.jar --realmFile c:\myrealm.txt --storePassword something \ No newline at end of file
+ java -jar gitblit.jar --realmFile c:\myrealm.txt --storePassword something
+
+## Client Setup and Configuration
+### Https with Self-Signed Certificates
+You must tell Git not to verify the self-signed certificate in order to perform any remote Git operations.
+
+- Eclipse/EGit
+ 1. Window->Preferences->Team->Git->Configuration
+ 2. Click the *New Entry* button
+ 3. <pre>Key = *http.sslVerify*
+ Value = *false*</pre>
+- Command-line Git ([Git-Config Manual Page](http://www.kernel.org/pub/software/scm/git/docs/git-config.html))
+ <pre>git-config --global --bool --add http.sslVerify false</pre>
+
+### Cloning an Access Restricted Repository
+- Eclipse/Egit<br/>Nothing special to configure, EGit figures out everything.
+ <pre>https://yourserver/git/your/repository</pre>
+- Command-line Git<br/>*My testing indicates that your username must be embedded in the url. YMMV.*
+ <pre>https://username@yourserver/git/your/repository</pre>
+ \ No newline at end of file
diff --git a/docs/01_eclipse.mkd b/docs/01_eclipse.mkd
deleted file mode 100644
index e768b73a..00000000
--- a/docs/01_eclipse.mkd
+++ /dev/null
@@ -1,18 +0,0 @@
-## Eclipse Tips
-
-### Do Not Verify Self-Signed Certificates
-If you are using a self-signed certificate, like the one that is automatically generated by Gitblit, you have to tell Eclipse/EGit to ignore certificate verification errors.
-
-![sslverify](sslverify.png "http.sslVerify setting")
-
-![sslverify2](sslverify2.png "Adding http.sslVerify setting")
-
-### Pushing a New Project to a New Gitblit Repository
-1. Project Root->Team->Share->Git
-Create a Git repository inside the project
-
-### Pushing a Git-Controlled Project to another Gitblit Repository
-1. Project Root->Team->Remote->Push
-2. Enter the URL information of the repository
-3. In the Refspec dialog click the buttons named "All all branches spec" and "All all tags spec"
-
diff --git a/docs/01_faq.mkd b/docs/01_faq.mkd
index 86aa9ad2..5068e79a 100644
--- a/docs/01_faq.mkd
+++ b/docs/01_faq.mkd
@@ -1,10 +1,31 @@
-## Frequently Asked Questions
+## Troubleshooting
+
+### Eclipse/Egit/Git complains that it "can't open upload pack"?
+There are a few ways this can occur:
+
+1. You are using https with a self-signed certificate and you **did not** configure *http.sslVerify=false*
+ 1. Window->Preferences->Team->Git->Configuration
+ 2. Click the *New Entry* button
+ 3. <pre>Key = *http.sslVerify*
+ Value = *false*</pre>
+2. The repository is clone-restricted and you don't have access.
+3. The repository is clone-restricted and your password changed.
+4. A regression in Gitblit. :(
+
+### Why can't I access Gitblit from another machine?
+Please check *server.httpBindInterface* and *server.httpsBindInterface* in `gitblit.properties`.
+
+### How do I run Gitblit on port 80 or 443 in Linux?
+Linux requires root permissions to serve on ports < 1024.<br/>
+Run the server as *root* (security concern) or change the ports you are serving to 8080 (http) and/or 8443 (https).
+
+## General Interest Questions
### Gitblit? What kind of name is that?
-Its a phonetic play on [bitblt][bitblt] which is an image processing operation meaning *bit-block transfer*.
+It's a phonetic play on [bitblt][bitblt] which is an image processing operation meaning *bit-block transfer*.
### Why use Gitblit?
-Its small. Its portable. Its easy to manage.
+It's a small tool that allows you to easily manage shared repositories and doesn't require alot of setup or git kung-foo.
### Do I need real Git?
No. Gitblit is based on [JGit][jgit] which is a pure Java implementation of the [Git version control system][git].<br/>
@@ -13,11 +34,16 @@ Everything you need for Gitblit is either in the zip distribution file or automa
### Do I need a JDK or can I use a JRE?
Gitblit will run just fine with a JRE. Gitblit can optionally use `keytool` from the JDK to generate self-signed certificates, but normally Gitblit uses [BouncyCastle][bouncycastle] for that need.
+### I want to deploy Gitblit into my own servlet container. Where is the WAR?
+At this time there is no WAR build available.
+
### Does Gitblit use a database to store its data?
No. Gitblit stores its repository configuration information within the `.git/config` file and its user information in `users.properties` or whatever filename is configured in `gitblit.properties`.
-### I want to deploy Gitblit into my own servlet container. Where is the WAR?
-At this time there is no WAR build available.
+### Can I manually edit users.properties, gitblit.properties, or .git/config?
+Yes. You can manually manipulate all of them and (most) changes will be immediately available to Gitblit.<br/>Exceptions to this are noted in `gitblit.properties`.
+
+*NOTE:* Care must be taken to preserve the relationship between user roles and repository names.<br/>Please see the [setup](/setup.html) page for details.
### Can I restrict access to paths within a repository?
No. Access restrictions apply to the repository as a whole.
@@ -26,7 +52,7 @@ Gitblit's simple authentication and authorization mechanism can be used to facil
### Why doesn't Gitblit support SSH?
Gitblit could integrate [Apache Mina][mina] to provide SSH access. However, doing so violates Gitblit's first design principle: [KISS](http://en.wikipedia.org/wiki/KISS_principle).<br/>
-SSH support requires creating, exchanging, and managing SSH keys. While this is possible, JGit's SmartHTTP implementation is a simpler and cleaner transport mechanism.
+SSH support requires creating, exchanging, and managing SSH keys. While this is possible, JGit's SmartHTTP implementation is a simpler and universal transport mechanism.
You might consider running [Gerrit](http://gerrit.googlecode.org) which does integrate [Apache Mina][mina] and supports SSH or you might consider serving [Git][git] on Linux which would offer real SSH support and also allow use of [many other compelling Git solutions](https://git.wiki.kernel.org/index.php/InterfacesFrontendsAndTools).
@@ -40,9 +66,8 @@ To search by *author* or *committer* use the following syntax in the search box:
Alternatively, you could enable the search type dropdown list in your `gitblit.properties` file.
-### How do I run Gitblit on port 80 or 443 in Linux?
-Linux requires root permissions to serve on ports < 1024.<br/>
-Run the server as *root* (security concern) or change the ports you are serving to 8080 (http) and/or 8443 (https).
+### I see a disabled "blame" link. How do I enable it?
+Currently blame is not implemented. Those links are placeholders to remind me where Gitweb offers blame.
[bitblt]: http://en.wikipedia.org/wiki/Bit_blit "Wikipedia Bitblt"
[jgit]: http://eclipse.org/jgit "Eclipse JGit Site"
diff --git a/docs/02_properties.mkd b/docs/02_properties.mkd
new file mode 100644
index 00000000..3a1dec17
--- /dev/null
+++ b/docs/02_properties.mkd
@@ -0,0 +1,4 @@
+## gitblit.properties
+<pre class='prettyprint'>
+%PROPERTIES%
+</pre> \ No newline at end of file
diff --git a/docs/page_header.html b/docs/page_header.html
index fd40c5a2..4a2128e0 100644
--- a/docs/page_header.html
+++ b/docs/page_header.html
@@ -8,6 +8,7 @@
<meta name="ROBOTS" content="INDEX, NOFOLLOW">
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta name="keywords" content="java git server" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script>
@@ -23,8 +24,11 @@
list-style: none;
'}'
</style>
+
+ <script type="text/javascript" src="prettify/prettify.js"></script>
+ <link href="prettify/prettify.css" type="text/css" rel="stylesheet" />
</head>
- <body>
+ <body onload="prettyPrint()">
<div class="page_header">
<a title="gitblit homepage" href="http://gitblit.com/">
<img src="./gitblt_25.png" width="79" height="25" alt="gitblit" class="logo"/>
diff --git a/docs/sslverify.png b/docs/sslverify.png
deleted file mode 100644
index e987b9f0..00000000
--- a/docs/sslverify.png
+++ /dev/null
Binary files differ
diff --git a/docs/sslverify2.png b/docs/sslverify2.png
deleted file mode 100644
index 94db9776..00000000
--- a/docs/sslverify2.png
+++ /dev/null
Binary files differ
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;
diff --git a/tests/com/gitblit/tests/GitBlitSuite.java b/tests/com/gitblit/tests/GitBlitSuite.java
index eaa028d7..a31b0131 100644
--- a/tests/com/gitblit/tests/GitBlitSuite.java
+++ b/tests/com/gitblit/tests/GitBlitSuite.java
@@ -23,7 +23,7 @@ public class GitBlitSuite extends TestSetup {
suite.addTestSuite(JGitUtilsTest.class);
return new GitBlitSuite(suite);
}
-
+
public static Repository getHelloworldRepository() throws Exception {
return new FileRepository(new File(REPOSITORIES, "helloworld.git"));
}
diff --git a/tests/com/gitblit/tests/JGitUtilsTest.java b/tests/com/gitblit/tests/JGitUtilsTest.java
index 0432d39d..7fcf48d7 100644
--- a/tests/com/gitblit/tests/JGitUtilsTest.java
+++ b/tests/com/gitblit/tests/JGitUtilsTest.java
@@ -29,11 +29,12 @@ import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevObject;
import org.eclipse.jgit.revwalk.RevTree;
+import com.gitblit.models.PathModel.PathChangeModel;
+import com.gitblit.models.RefModel;
+import com.gitblit.models.TicketModel;
+import com.gitblit.utils.DiffUtils;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.JGitUtils.DiffOutputType;
-import com.gitblit.wicket.models.PathModel.PathChangeModel;
-import com.gitblit.wicket.models.RefModel;
-import com.gitblit.wicket.models.TicketModel;
public class JGitUtilsTest extends TestCase {
@@ -100,7 +101,7 @@ public class JGitUtilsTest extends TestCase {
Repository repository = GitBlitSuite.getHelloworldRepository();
RevCommit commit = JGitUtils.getCommit(repository,
"1d0c2933a4ae69c362f76797d42d6bd182d05176");
- String diff = JGitUtils.getCommitDiff(repository, commit, DiffOutputType.PLAIN);
+ String diff = DiffUtils.getCommitDiff(repository, commit, DiffOutputType.PLAIN);
repository.close();
assertTrue("Failed to generate diff!", diff != null && diff.length() > 0);
String expected = "- system.out.println(\"Hello World\");\n+ System.out.println(\"Hello World\"";