James Moger
2011-05-27 1f9daef870a8c7a984955166a542628d69012ed5
Codepro analyze dependencies. Documentation.
2 files added
16 files renamed
54 files modified
3 files deleted
857 ■■■■ changed files
README.MKD 23 ●●●● patch | view | raw | blame | history
build.xml 19 ●●●● patch | view | raw | blame | history
distrib/gitblit.properties 52 ●●●● patch | view | raw | blame | history
docs/00_index.mkd 11 ●●●●● patch | view | raw | blame | history
docs/00_setup.mkd 23 ●●●●● patch | view | raw | blame | history
docs/01_eclipse.mkd 18 ●●●●● patch | view | raw | blame | history
docs/01_faq.mkd 43 ●●●● patch | view | raw | blame | history
docs/02_properties.mkd 4 ●●●● patch | view | raw | blame | history
docs/page_header.html 6 ●●●● patch | view | raw | blame | history
docs/sslverify.png patch | view | raw | blame | history
docs/sslverify2.png patch | view | raw | blame | history
src/com/gitblit/Build.java 9 ●●●●● patch | view | raw | blame | history
src/com/gitblit/BuildSite.java 22 ●●●● patch | view | raw | blame | history
src/com/gitblit/Constants.java 2 ●●●●● patch | view | raw | blame | history
src/com/gitblit/DownloadZipServlet.java 2 ●●● patch | view | raw | blame | history
src/com/gitblit/GitBlit.java 13 ●●●●● patch | view | raw | blame | history
src/com/gitblit/GitBlitServer.java 39 ●●●● patch | view | raw | blame | history
src/com/gitblit/GitBlitServlet.java 2 ●●● patch | view | raw | blame | history
src/com/gitblit/ILoginService.java 2 ●●● patch | view | raw | blame | history
src/com/gitblit/JettyLoginService.java 2 ●●● patch | view | raw | blame | history
src/com/gitblit/MakeCertificate.java 6 ●●●● patch | view | raw | blame | history
src/com/gitblit/models/Metric.java 2 ●●● patch | view | raw | blame | history
src/com/gitblit/models/PathModel.java 7 ●●●●● patch | view | raw | blame | history
src/com/gitblit/models/RefModel.java 6 ●●●●● patch | view | raw | blame | history
src/com/gitblit/models/RepositoryModel.java 4 ●●●● patch | view | raw | blame | history
src/com/gitblit/models/TicketModel.java 8 ●●●● patch | view | raw | blame | history
src/com/gitblit/models/UserModel.java 2 ●●● patch | view | raw | blame | history
src/com/gitblit/utils/DiffUtils.java 149 ●●●●● patch | view | raw | blame | history
src/com/gitblit/utils/JGitUtils.java 147 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/AuthorizationStrategy.java 6 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/GitBlitWebApp.java 2 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/GitBlitWebSession.java 2 ●●● patch | view | raw | blame | history
src/com/gitblit/wicket/RequiresAdminRole.java 2 ●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/BasePage.html 6 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/BasePage.java 6 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/BlobDiffPage.java 6 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/BlobPage.java 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/BranchesPage.java 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/CommitDiffPage.java 8 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/CommitPage.java 5 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/DocsPage.java 5 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/EditRepositoryPage.java 7 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/EditUserPage.java 9 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/HistoryPage.java 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/LogPage.java 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/LoginPage.html 6 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/LoginPage.java 59 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/LogoutPage.java 2 ●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/MarkdownPage.java 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/PatchPage.java 3 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/RepositoriesPage.java 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/RepositoryPage.html patch | view | raw | blame | history
src/com/gitblit/wicket/pages/RepositoryPage.java 16 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/SearchPage.java 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/SummaryPage.java 3 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/TagPage.java 5 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/TagsPage.java 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/TicketPage.java 5 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/TicketsPage.java 5 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/TreePage.java 5 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/BranchesPanel.java 5 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/CommitHeaderPanel.java 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/CommitLegendPanel.java 2 ●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/HistoryPanel.java 5 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/LinkPanel.html patch | view | raw | blame | history
src/com/gitblit/wicket/panels/LinkPanel.java 2 ●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/LogPanel.java 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java 15 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/RefsPanel.java 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/RepositoriesPanel.java 5 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/SearchPanel.java 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/TagsPanel.java 3 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/UsersPanel.java 1 ●●●● patch | view | raw | blame | history
tests/com/gitblit/tests/GitBlitSuite.java 2 ●●● patch | view | raw | blame | history
tests/com/gitblit/tests/JGitUtilsTest.java 9 ●●●●● patch | view | raw | blame | history
README.MKD
@@ -1,18 +1,9 @@
Gitblit
=================
Gitblit is an open source, pure Java Git solution.
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).
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
License
-------
@@ -28,8 +19,7 @@
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 @@
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.
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.
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>
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 @@
#
# 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 @@
# 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 @@
# 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.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.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 @@
#
# 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 @@
# 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 @@
# 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
docs/00_index.mkd
@@ -107,10 +107,10 @@
- [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 @@
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"
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 @@
    
**Example**
    java -jar gitblit.jar --realmFile c:\myrealm.txt --storePassword something
    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>
docs/01_eclipse.mkd
File was deleted
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 @@
### 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 @@
### 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 @@
    
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"
docs/02_properties.mkd
New file
@@ -0,0 +1,4 @@
## gitblit.properties
<pre class='prettyprint'>
%PROPERTIES%
</pre>
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"/>
docs/sslverify.png
Binary files differ
docs/sslverify2.png
Binary files differ
src/com/gitblit/Build.java
@@ -80,7 +80,7 @@
        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 @@
                "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");
src/com/gitblit/BuildSite.java
@@ -37,6 +37,7 @@
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 @@
        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 @@
                    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 @@
        }
    }
    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 @@
            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 @@
        @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>();
    }
}
src/com/gitblit/Constants.java
@@ -37,6 +37,8 @@
    public static final String ZIP_SERVLET_PATH = "/zip/";
    public static final String BORDER = "***********************************************************";
    public static enum AccessRestrictionType {
        NONE, PUSH, CLONE, VIEW;
src/com/gitblit/DownloadZipServlet.java
@@ -26,9 +26,9 @@
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 {
src/com/gitblit/GitBlit.java
@@ -35,10 +35,10 @@
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 @@
            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 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 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);
src/com/gitblit/GitBlitServer.java
@@ -65,11 +65,7 @@
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();
@@ -91,9 +87,9 @@
    }
    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 @@
     * 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 @@
        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 @@
        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 @@
            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 @@
        // 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 @@
            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 @@
        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 @@
                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 @@
    @Parameters(separators = " ")
    private static class Params {
        private static final FileSettings FILESETTINGS = new FileSettings();
        /*
         * Server parameters
src/com/gitblit/GitBlitServlet.java
@@ -27,7 +27,7 @@
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 {
src/com/gitblit/ILoginService.java
@@ -17,7 +17,7 @@
import java.util.List;
import com.gitblit.wicket.models.UserModel;
import com.gitblit.models.UserModel;
public interface ILoginService {
src/com/gitblit/JettyLoginService.java
@@ -38,7 +38,7 @@
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 {
src/com/gitblit/MakeCertificate.java
@@ -44,9 +44,7 @@
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 @@
    @Parameters(separators = " ")
    private static class Params {
        private static final FileSettings FILESETTINGS = new FileSettings();
        @Parameter(names = { "--alias" }, description = "Server alias", required = true)
        public String alias;
src/com/gitblit/models/Metric.java
File was renamed from src/com/gitblit/wicket/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;
src/com/gitblit/models/PathModel.java
File was renamed from src/com/gitblit/wicket/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 boolean isTree() {
        return JGitUtils.isTreeFromMode(mode);
        return FileMode.TREE.equals(mode);
    }
    public static PathModel getParentPath(String basePath, String commitId) {
src/com/gitblit/models/RefModel.java
File was renamed from src/com/gitblit/wicket/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;
@@ -21,8 +21,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> {
@@ -38,7 +36,7 @@
    }
    public Date getDate() {
        return JGitUtils.getCommitDate(commit);
        return new Date(commit.getCommitTime() * 1000L);
    }
    public String getName() {
src/com/gitblit/models/RepositoryModel.java
File was renamed from src/com/gitblit/wicket/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 @@
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;
src/com/gitblit/models/TicketModel.java
File was renamed from src/com/gitblit/wicket/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;
@@ -36,12 +36,6 @@
    public String author;
    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 = "";
src/com/gitblit/models/UserModel.java
File was renamed from src/com/gitblit/wicket/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;
src/com/gitblit/utils/DiffUtils.java
New file
@@ -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;
    }
}
src/com/gitblit/utils/JGitUtils.java
@@ -73,12 +73,12 @@
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 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());
        }
@@ -458,132 +465,6 @@
            }
            return null;
        }
    }
    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) {
src/com/gitblit/wicket/AuthorizationStrategy.java
@@ -22,7 +22,9 @@
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 @@
            }
            UserModel user = session.getUser();
            if (pageClass.isAnnotationPresent(AdminPage.class)) {
            if (pageClass.isAnnotationPresent(RequiresAdminRole.class)) {
                // admin page
                if (allowAdmin) {
                    if (authenticateAdmin) {
src/com/gitblit/wicket/GitBlitWebApp.java
@@ -34,6 +34,8 @@
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;
src/com/gitblit/wicket/GitBlitWebSession.java
@@ -22,7 +22,7 @@
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 {
src/com/gitblit/wicket/RequiresAdminRole.java
File was renamed from src/com/gitblit/wicket/AdminPage.java
@@ -22,5 +22,5 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface AdminPage {
public @interface RequiresAdminRole {
}
src/com/gitblit/wicket/pages/BasePage.html
File was renamed from src/com/gitblit/wicket/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>
src/com/gitblit/wicket/pages/BasePage.java
File was renamed from src/com/gitblit/wicket/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.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 {
src/com/gitblit/wicket/pages/BlobDiffPage.java
@@ -23,10 +23,10 @@
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 @@
        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)));
src/com/gitblit/wicket/pages/BlobPage.java
@@ -29,7 +29,6 @@
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;
src/com/gitblit/wicket/pages/BranchesPage.java
@@ -17,7 +17,6 @@
import org.apache.wicket.PageParameters;
import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.panels.BranchesPanel;
public class BranchesPage extends RepositoryPage {
src/com/gitblit/wicket/pages/CommitDiffPage.java
@@ -29,14 +29,14 @@
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 @@
        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) {
src/com/gitblit/wicket/pages/CommitPage.java
@@ -32,14 +32,13 @@
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 {
src/com/gitblit/wicket/pages/DocsPage.java
@@ -27,12 +27,11 @@
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 {
src/com/gitblit/wicket/pages/EditRepositoryPage.java
@@ -40,12 +40,11 @@
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 @@
        // create constructor
        super();
        isCreate = true;
        setupPage(new RepositoryModel("", "", "", new Date()));
        setupPage(new RepositoryModel());
    }
    public EditRepositoryPage(PageParameters params) {
src/com/gitblit/wicket/pages/EditUserPage.java
@@ -38,14 +38,13 @@
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;
src/com/gitblit/wicket/pages/HistoryPage.java
@@ -18,7 +18,6 @@
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;
src/com/gitblit/wicket/pages/LogPage.java
@@ -18,7 +18,6 @@
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;
src/com/gitblit/wicket/pages/LoginPage.html
File was renamed from src/com/gitblit/wicket/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>
src/com/gitblit/wicket/pages/LoginPage.java
File was renamed from src/com/gitblit/wicket/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 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,42 +39,37 @@
    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) {
src/com/gitblit/wicket/pages/LogoutPage.java
File was renamed from src/com/gitblit/wicket/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;
src/com/gitblit/wicket/pages/MarkdownPage.java
@@ -26,7 +26,6 @@
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 {
src/com/gitblit/wicket/pages/PatchPage.java
@@ -22,6 +22,7 @@
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 @@
        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();
    }
src/com/gitblit/wicket/pages/RepositoriesPage.java
@@ -28,7 +28,6 @@
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;
src/com/gitblit/wicket/pages/RepositoryPage.html
src/com/gitblit/wicket/pages/RepositoryPage.java
File was renamed from src/com/gitblit/wicket/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 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 {
src/com/gitblit/wicket/pages/SearchPage.java
@@ -19,7 +19,6 @@
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;
src/com/gitblit/wicket/pages/SummaryPage.java
@@ -42,12 +42,11 @@
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;
src/com/gitblit/wicket/pages/TagPage.java
@@ -21,12 +21,11 @@
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 {
src/com/gitblit/wicket/pages/TagsPage.java
@@ -17,7 +17,6 @@
import org.apache.wicket.PageParameters;
import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.panels.TagsPanel;
public class TagsPage extends RepositoryPage {
src/com/gitblit/wicket/pages/TicketPage.java
@@ -22,13 +22,12 @@
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 {
src/com/gitblit/wicket/pages/TicketsPage.java
@@ -23,13 +23,12 @@
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 {
src/com/gitblit/wicket/pages/TreePage.java
@@ -32,13 +32,12 @@
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 {
src/com/gitblit/wicket/panels/BranchesPanel.java
@@ -28,12 +28,11 @@
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;
src/com/gitblit/wicket/panels/CommitHeaderPanel.java
@@ -18,7 +18,6 @@
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;
src/com/gitblit/wicket/panels/CommitLegendPanel.java
@@ -28,9 +28,9 @@
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 {
src/com/gitblit/wicket/panels/HistoryPanel.java
@@ -32,13 +32,12 @@
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;
src/com/gitblit/wicket/panels/LinkPanel.html
src/com/gitblit/wicket/panels/LinkPanel.java
File was renamed from src/com/gitblit/wicket/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;
src/com/gitblit/wicket/panels/LogPanel.java
@@ -34,7 +34,6 @@
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;
src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java
@@ -25,7 +25,6 @@
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 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 @@
            this.name = name;
            this.path = path;
            this.isLeaf = isLeaf;
        }
        String getPath() {
            if (path.equals(ROOT)) {
                return null;
            }
            return path;
        }
        }
    }
}
src/com/gitblit/wicket/panels/RefsPanel.java
@@ -29,7 +29,6 @@
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;
src/com/gitblit/wicket/panels/RepositoriesPanel.java
@@ -43,13 +43,12 @@
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;
src/com/gitblit/wicket/panels/SearchPanel.java
@@ -32,7 +32,6 @@
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;
src/com/gitblit/wicket/panels/TagsPanel.java
@@ -26,11 +26,10 @@
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;
src/com/gitblit/wicket/panels/UsersPanel.java
@@ -26,7 +26,6 @@
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;
tests/com/gitblit/tests/GitBlitSuite.java
@@ -23,7 +23,7 @@
        suite.addTestSuite(JGitUtilsTest.class);
        return new GitBlitSuite(suite);
    }
    public static Repository getHelloworldRepository() throws Exception {
        return new FileRepository(new File(REPOSITORIES, "helloworld.git"));
    }
tests/com/gitblit/tests/JGitUtilsTest.java
@@ -29,11 +29,12 @@
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 @@
        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\"";