From a2709dd91e5d6b18f573016882ccc70799573ad3 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 22 Jul 2011 17:47:53 -0400
Subject: [PATCH] Centralize default branch/HEAD resolution (issue 14)

---
 src/com/gitblit/wicket/panels/BranchesPanel.java |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/com/gitblit/wicket/panels/BranchesPanel.java b/src/com/gitblit/wicket/panels/BranchesPanel.java
index 24e0e98..92413ee 100644
--- a/src/com/gitblit/wicket/panels/BranchesPanel.java
+++ b/src/com/gitblit/wicket/panels/BranchesPanel.java
@@ -27,6 +27,7 @@
 import org.apache.wicket.markup.repeater.data.DataView;
 import org.apache.wicket.markup.repeater.data.ListDataProvider;
 import org.apache.wicket.model.StringResourceModel;
+import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.Repository;
 
 import com.gitblit.SyndicationServlet;
@@ -142,7 +143,9 @@
 					this, null), BranchesPage.class, WicketUtils.newRepositoryParameter(model.name)));
 		}
 		// We always have 1 branch
-		hasBranches = branches.size() > 1;
+		hasBranches = (branches.size() > 1)
+				|| ((branches.size() == 1) && !branches.get(0).displayName
+						.equalsIgnoreCase(Constants.HEAD));
 	}
 
 	public BranchesPanel hideIfEmpty() {

--
Gitblit v1.9.1