Paul Martin
2016-04-30 a502d96a860456ec5e8c96761db70f7cabb74751
src/main/java/com/gitblit/wicket/pages/RepositoryPage.java
@@ -64,6 +64,7 @@
import com.gitblit.utils.BugtraqProcessor;
import com.gitblit.utils.DeepCopier;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.ModelUtils;
import com.gitblit.utils.RefLogUtils;
import com.gitblit.utils.StringUtils;
import com.gitblit.wicket.CacheControl;
@@ -268,8 +269,15 @@
   @Override
   protected void setupPage(String repositoryName, String pageName) {
      //This method should only be called once in the page lifecycle.
      //However, it must be called after the constructor has run, hence not in onInitialize
      //It may be attempted to be called again if an info or error message is displayed.
      if (get("projectTitle") != null) { return; }
      String projectName = StringUtils.getFirstPathElement(repositoryName);
      ProjectModel project = app().projects().getProjectModel(projectName);
      if (project.isUserProject()) {
         // user-as-project
         add(new LinkPanel("projectTitle", null, project.getDisplayName(),
@@ -370,8 +378,10 @@
         add(new ExternalLink("myForkLink", "").setVisible(false));
      } else {
         String fork = app().repositories().getFork(user.username, model.name);
         String userRepo = ModelUtils.getPersonalPath(user.username) + "/" + StringUtils.stripDotGit(StringUtils.getLastPathElement(model.name));
         boolean hasUserRepo = app().repositories().hasRepository(userRepo);
         boolean hasFork = fork != null;
         boolean canFork = user.canFork(model) && model.hasCommits;
         boolean canFork = user.canFork(model) && model.hasCommits && !hasUserRepo;
         if (hasFork || !canFork) {
            // user not allowed to fork or fork already exists or repo forbids forking
@@ -659,6 +669,7 @@
      }
   }
   @Override
   protected void onBeforeRender() {
      // dispose of repository object
@@ -666,8 +677,10 @@
         r.close();
         r = null;
      }
      // setup page header and footer
      setupPage(getRepositoryName(), "/ " + getPageName());
      super.onBeforeRender();
   }