From bd01eebfa57b4012bc7a7abc1aaaa1b69278b9de Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sun, 19 Feb 2012 15:38:50 -0500
Subject: [PATCH] Merged issues/lucene branch

---
 src/com/gitblit/wicket/pages/SummaryPage.java |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/com/gitblit/wicket/pages/SummaryPage.java b/src/com/gitblit/wicket/pages/SummaryPage.java
index ed90a84..acb4180 100644
--- a/src/com/gitblit/wicket/pages/SummaryPage.java
+++ b/src/com/gitblit/wicket/pages/SummaryPage.java
@@ -22,9 +22,11 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.wicket.Component;
 import org.apache.wicket.PageParameters;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.link.BookmarkablePageLink;
+import org.apache.wicket.markup.html.panel.Fragment;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.revwalk.RevCommit;
 import org.wicketstuff.googlecharts.Chart;
@@ -37,13 +39,13 @@
 import org.wicketstuff.googlecharts.MarkerType;
 import org.wicketstuff.googlecharts.ShapeMarker;
 
-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.models.PathModel;
 import com.gitblit.models.RepositoryModel;
+import com.gitblit.utils.ArrayUtils;
 import com.gitblit.utils.JGitUtils;
 import com.gitblit.utils.MarkdownUtils;
 import com.gitblit.utils.StringUtils;
@@ -116,33 +118,30 @@
 			default:
 				add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false));
 			}
-			StringBuilder sb = new StringBuilder();
-			sb.append(WicketUtils.getGitblitURL(getRequestCycle().getRequest()));
-			sb.append(Constants.GIT_PATH);
-			sb.append(repositoryName);
-			repositoryUrls.add(sb.toString());
+			// add the Gitblit repository url
+			repositoryUrls.add(getRepositoryUrl(getRepositoryModel()));
 		} else {
 			add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false));
 		}
 		repositoryUrls.addAll(GitBlit.self().getOtherCloneUrls(repositoryName));
 		
-		String primaryUrl = repositoryUrls.remove(0);
+		String primaryUrl = ArrayUtils.isEmpty(repositoryUrls) ? "" : repositoryUrls.remove(0);
 		add(new RepositoryUrlPanel("repositoryCloneUrl", primaryUrl));
 
 		add(new Label("otherUrls", StringUtils.flattenStrings(repositoryUrls, "<br/>"))
 		.setEscapeModelStrings(false));
 
-		add(new LogPanel("commitsPanel", repositoryName, null, r, numberCommits, 0));
+		add(new LogPanel("commitsPanel", repositoryName, getRepositoryModel().HEAD, r, numberCommits, 0));
 		add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs).hideIfEmpty());
 		add(new BranchesPanel("branchesPanel", getRepositoryModel(), r, numberRefs).hideIfEmpty());
 
 		if (getRepositoryModel().showReadme) {
 			String htmlText = null;
+			String readme = null;
 			try {
 				RevCommit head = JGitUtils.getCommit(r, null);
 				List<String> markdownExtensions = GitBlit.getStrings(Keys.web.markdownExtensions);
-				List<PathModel> paths = JGitUtils.getFilesInPath(r, null, head);
-				String readme = null;
+				List<PathModel> paths = JGitUtils.getFilesInPath(r, null, head);				
 				for (PathModel path : paths) {
 					if (!path.isTree()) {
 						String name = path.name.toLowerCase();
@@ -165,9 +164,12 @@
 			} catch (ParseException p) {
 				error(p.getMessage());
 			}
+			Fragment fragment = new Fragment("readme", "markdownPanel");
+			fragment.add(new Label("readmeFile", readme));
 			// Add the html to the page
-			add(new Label("readme", htmlText).setEscapeModelStrings(false).setVisible(
-					!StringUtils.isEmpty(htmlText)));
+			Component content = new Label("readmeContent", htmlText).setEscapeModelStrings(false);
+			fragment.add(content.setVisible(!StringUtils.isEmpty(htmlText)));
+			add(fragment);
 		} else {
 			add(new Label("readme").setVisible(false));
 		}

--
Gitblit v1.9.1