From 2bfc887835c8364daf33e1c290c80ec18e4d82db Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sun, 25 Mar 2012 18:01:59 -0400
Subject: [PATCH] Fixed Gravatar image security exception with Wicket 1.4.20

---
 src/com/gitblit/wicket/pages/EditRepositoryPage.java |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/com/gitblit/wicket/pages/EditRepositoryPage.java b/src/com/gitblit/wicket/pages/EditRepositoryPage.java
index 172859f..c2fc9f5 100644
--- a/src/com/gitblit/wicket/pages/EditRepositoryPage.java
+++ b/src/com/gitblit/wicket/pages/EditRepositoryPage.java
@@ -39,7 +39,6 @@
 import org.apache.wicket.model.Model;
 import org.apache.wicket.model.util.CollectionModel;
 import org.apache.wicket.model.util.ListModel;
-import org.eclipse.jgit.lib.Constants;
 
 import com.gitblit.Constants.AccessRestrictionType;
 import com.gitblit.Constants.FederationStrategy;
@@ -117,19 +116,12 @@
 				new StringChoiceRenderer(), 8, false);
 
 		// indexed local branches palette
-		List<String> allLocalBranches = new ArrayList<String>();
-		if (!ArrayUtils.isEmpty(repositoryModel.availableRefs)) {
-			for (String ref : repositoryModel.availableRefs) {
-				if (ref.startsWith(Constants.R_HEADS)) {
-					allLocalBranches.add(ref);
-				}
-			}
-		}
+		List<String> allLocalBranches = repositoryModel.getLocalBranches();
+		boolean luceneEnabled = GitBlit.getBoolean(Keys.web.allowLuceneIndexing, true);
 		final Palette<String> indexedBranchesPalette = new Palette<String>("indexedBranches", new ListModel<String>(
 				indexedBranches), new CollectionModel<String>(allLocalBranches),
 				new StringChoiceRenderer(), 8, false);
-		indexedBranchesPalette.setEnabled(allLocalBranches.size() > 0);
-
+		indexedBranchesPalette.setEnabled(luceneEnabled && (allLocalBranches.size() > 0));
 		
 		// federation sets palette
 		List<String> sets = GitBlit.getStrings(Keys.federation.sets);
@@ -309,7 +301,7 @@
 		if (!ArrayUtils.isEmpty(repositoryModel.availableRefs)) {
 			availableRefs.addAll(repositoryModel.availableRefs);
 		}
-		form.add(new DropDownChoice<String>("HEAD", availableRefs).setEnabled(!isCreate));
+		form.add(new DropDownChoice<String>("HEAD", availableRefs).setEnabled(availableRefs.size() > 0));
 
 		// federation strategies - remove ORIGIN choice if this repository has
 		// no origin.

--
Gitblit v1.9.1