James Moger
2013-07-15 8f6e672ffe19c439aadc07b64e36ae4b83e78f1e
src/main/java/com/gitblit/wicket/panels/HistoryPanel.java
@@ -42,9 +42,9 @@
import com.gitblit.GitBlit;
import com.gitblit.Keys;
import com.gitblit.models.PathModel;
import com.gitblit.models.SubmoduleModel;
import com.gitblit.models.PathModel.PathChangeModel;
import com.gitblit.models.RefModel;
import com.gitblit.models.SubmoduleModel;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
import com.gitblit.wicket.WicketUtils;
@@ -109,13 +109,13 @@
      }
      
      final boolean isTree = matchingPath == null ? true : matchingPath.isTree();
      final boolean isSubmodule = matchingPath == null ? true : matchingPath.isSubmodule();
      final boolean isSubmodule = matchingPath == null ? false : matchingPath.isSubmodule();
      // submodule
      SubmoduleModel submodule = getSubmodule(submodules, repositoryName, matchingPath.path);
      final String submodulePath;
      final boolean hasSubmodule; 
      if (submodule != null) {
      if (isSubmodule) {
         SubmoduleModel submodule = getSubmodule(submodules, repositoryName, matchingPath == null ? null : matchingPath.path);
         submodulePath = submodule.gitblitPath;
         hasSubmodule = submodule.hasSubmodule;
      } else {
@@ -204,17 +204,23 @@
               item.add(links);
            } else if (isSubmodule) {
               // submodule
               item.add(new Label("hashLabel", submodulePath + "@"));
               Repository repository = GitBlit.self().getRepository(repositoryName);
               String submoduleId = JGitUtils.getSubmoduleCommitId(repository, path, entry);
               repository.close();
               LinkPanel commitHash = new LinkPanel("hashLink", null, submoduleId.substring(0, hashLen),
                     TreePage.class, WicketUtils.newObjectParameter(
                           submodulePath, submoduleId));
               WicketUtils.setCssClass(commitHash, "shortsha1");
               WicketUtils.setHtmlTooltip(commitHash, submoduleId);
               item.add(commitHash.setEnabled(hasSubmodule));
               if (StringUtils.isEmpty(submoduleId)) {
                  // not a submodule at this commit, just a matching path
                  item.add(new Label("hashLabel").setVisible(false));
                  item.add(new Label("hashLink").setVisible(false));
               } else {
                  // really a submodule
                  item.add(new Label("hashLabel", submodulePath + "@"));
                  LinkPanel commitHash = new LinkPanel("hashLink", null, submoduleId.substring(0, hashLen),
                        TreePage.class, WicketUtils.newObjectParameter(
                              submodulePath, submoduleId));
                  WicketUtils.setCssClass(commitHash, "shortsha1");
                  WicketUtils.setHtmlTooltip(commitHash, submoduleId);
                  item.add(commitHash.setEnabled(hasSubmodule));
               }
               Fragment links = new Fragment("historyLinks", "treeLinks", this);
               links.add(new BookmarkablePageLink<Void>("commitdiff", CommitDiffPage.class,
                     WicketUtils.newObjectParameter(repositoryName, entry.getName())));
@@ -303,7 +309,7 @@
         if (submoduleName.lastIndexOf('/') > -1) {
            String name = submoduleName.substring(submoduleName.lastIndexOf('/') + 1);
            candidates.add(currentPath + StringUtils.stripDotGit(name));
            candidates.add(currentPath + candidates.get(candidates.size() - 1) + ".git");
            candidates.add(candidates.get(candidates.size() - 1) + ".git");
         }
         // absolute