distrib/gitblit.properties | ●●●●● patch | view | raw | blame | history | |
docs/04_releases.mkd | ●●●●● patch | view | raw | blame | history | |
src/com/gitblit/Constants.java | ●●●●● patch | view | raw | blame | history | |
src/com/gitblit/GitBlit.java | ●●●●● patch | view | raw | blame | history | |
tests/com/gitblit/tests/RepositoryModelTest.java | ●●●●● patch | view | raw | blame | history |
distrib/gitblit.properties
@@ -91,6 +91,21 @@ # SINCE 0.8.0 groovy.postReceiveScripts = # Repository custom fields for Groovy Hook mechanism # # List of key=label pairs of custom fields to prompt for in the Edit Repository # page. These keys are stored in the repository's git config file in the # section [gitblit "customFields"]. Key names are alphanumeric only. These # fields are intended to be used for the Groovy hook mechanism where a script # can adjust it's execution based on the custom fields stored in the repository # config. # # e.g. "commitMsgRegex=Commit Message Regular Expression" anotherProperty=Another # # SPACE-DELIMITED # SINCE 1.0.0 groovy.customFields = # # Authentication Settings # @@ -816,13 +831,3 @@ # SINCE 0.5.0 # RESTART REQUIRED server.shutdownPort = 8081 # Custom Defined Properties for Repositories # Space delimited (use quotes if labels have spaces) list of custom properties # to show up on the "Edit Repository" page, with labels. Thes custom properties will # then be available for hooks. # # E.g. "commit-msg-regex=Commit Message Regualar Expression" another-property=Another # # SINCE 1.0.0 repository.customFields = docs/04_releases.mkd
@@ -4,6 +4,10 @@ **%VERSION%** ([go](http://code.google.com/p/gitblit/downloads/detail?name=%GO%) | [war](http://code.google.com/p/gitblit/downloads/detail?name=%WAR%) | [express](http://code.google.com/p/gitblit/downloads/detail?name=%EXPRESS%) | [fedclient](http://code.google.com/p/gitblit/downloads/detail?name=%FEDCLIENT%) | [manager](http://code.google.com/p/gitblit/downloads/detail?name=%MANAGER%) | [api](http://code.google.com/p/gitblit/downloads/detail?name=%API%)) based on [%JGIT%][jgit] *released %BUILDDATE%* #### fixes - Fixed bug in Basic authentication if passwords had a colon (Github/peterloron) #### changes - IUserService interface has changed to better accomodate custom authentication and/or custom authorization @@ -11,6 +15,8 @@ #### additions - Added LDAP User Service with many new *realm.ldap* keys (Github/jcrygier) - Added support for custom repository properties for Groovy hooks (Github/jcrygier) - Added script to facilicate proxy environment setup on Linux (Github/mragab) **0.9.3** *released 2012-04-11* src/com/gitblit/Constants.java
@@ -72,9 +72,9 @@ public static final String DEFAULT_BRANCH = "default"; public static String CUSTOM_FIELDS_PROP_SECTION = "gitblit"; public static final String CONFIG_GITBLIT = "gitblit"; public static String CUSTOM_FIELDS_PROP_SUBSECTION = "customFields"; public static final String CONFIG_CUSTOM_FIELDS = "customFields"; public static String getGitBlitVersion() { return NAME + " v" + VERSION; src/com/gitblit/GitBlit.java
@@ -846,22 +846,22 @@ model.federationStrategy = FederationStrategy.fromName(getConfig(config, "federationStrategy", null)); model.federationSets = new ArrayList<String>(Arrays.asList(config.getStringList( "gitblit", null, "federationSets"))); Constants.CONFIG_GITBLIT, null, "federationSets"))); model.isFederated = getConfig(config, "isFederated", false); model.origin = config.getString("remote", "origin", "url"); model.preReceiveScripts = new ArrayList<String>(Arrays.asList(config.getStringList( "gitblit", null, "preReceiveScript"))); Constants.CONFIG_GITBLIT, null, "preReceiveScript"))); model.postReceiveScripts = new ArrayList<String>(Arrays.asList(config.getStringList( "gitblit", null, "postReceiveScript"))); Constants.CONFIG_GITBLIT, null, "postReceiveScript"))); model.mailingLists = new ArrayList<String>(Arrays.asList(config.getStringList( "gitblit", null, "mailingList"))); Constants.CONFIG_GITBLIT, null, "mailingList"))); model.indexedBranches = new ArrayList<String>(Arrays.asList(config.getStringList( "gitblit", null, "indexBranch"))); Constants.CONFIG_GITBLIT, null, "indexBranch"))); // Custom defined properties model.customFields = new HashMap<String, String>(); for (String aProperty : config.getNames(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION)) { model.customFields.put(aProperty, config.getString(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION, aProperty)); for (String aProperty : config.getNames(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS)) { model.customFields.put(aProperty, config.getString(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS, aProperty)); } } model.HEAD = JGitUtils.getHEADRef(r); @@ -956,7 +956,7 @@ * @return field value or defaultValue */ private String getConfig(StoredConfig config, String field, String defaultValue) { String value = config.getString("gitblit", null, field); String value = config.getString(Constants.CONFIG_GITBLIT, null, field); if (StringUtils.isEmpty(value)) { return defaultValue; } @@ -964,7 +964,7 @@ } /** * Returns the gitblit boolean vlaue for the specified key. If key is not * Returns the gitblit boolean value for the specified key. If key is not * set, returns defaultValue. * * @param config @@ -973,7 +973,7 @@ * @return field value or defaultValue */ private boolean getConfig(StoredConfig config, String field, boolean defaultValue) { return config.getBoolean("gitblit", field, defaultValue); return config.getBoolean(Constants.CONFIG_GITBLIT, field, defaultValue); } /** @@ -1090,19 +1090,19 @@ */ public void updateConfiguration(Repository r, RepositoryModel repository) { StoredConfig config = JGitUtils.readConfig(r); config.setString("gitblit", null, "description", repository.description); config.setString("gitblit", null, "owner", repository.owner); config.setBoolean("gitblit", null, "useTickets", repository.useTickets); config.setBoolean("gitblit", null, "useDocs", repository.useDocs); config.setString("gitblit", null, "accessRestriction", repository.accessRestriction.name()); config.setBoolean("gitblit", null, "showRemoteBranches", repository.showRemoteBranches); config.setBoolean("gitblit", null, "isFrozen", repository.isFrozen); config.setBoolean("gitblit", null, "showReadme", repository.showReadme); config.setBoolean("gitblit", null, "skipSizeCalculation", repository.skipSizeCalculation); config.setBoolean("gitblit", null, "skipSummaryMetrics", repository.skipSummaryMetrics); config.setString("gitblit", null, "federationStrategy", config.setString(Constants.CONFIG_GITBLIT, null, "description", repository.description); config.setString(Constants.CONFIG_GITBLIT, null, "owner", repository.owner); config.setBoolean(Constants.CONFIG_GITBLIT, null, "useTickets", repository.useTickets); config.setBoolean(Constants.CONFIG_GITBLIT, null, "useDocs", repository.useDocs); config.setString(Constants.CONFIG_GITBLIT, null, "accessRestriction", repository.accessRestriction.name()); config.setBoolean(Constants.CONFIG_GITBLIT, null, "showRemoteBranches", repository.showRemoteBranches); config.setBoolean(Constants.CONFIG_GITBLIT, null, "isFrozen", repository.isFrozen); config.setBoolean(Constants.CONFIG_GITBLIT, null, "showReadme", repository.showReadme); config.setBoolean(Constants.CONFIG_GITBLIT, null, "skipSizeCalculation", repository.skipSizeCalculation); config.setBoolean(Constants.CONFIG_GITBLIT, null, "skipSummaryMetrics", repository.skipSummaryMetrics); config.setString(Constants.CONFIG_GITBLIT, null, "federationStrategy", repository.federationStrategy.name()); config.setBoolean("gitblit", null, "isFederated", repository.isFederated); config.setBoolean(Constants.CONFIG_GITBLIT, null, "isFederated", repository.isFederated); updateList(config, "federationSets", repository.federationSets); updateList(config, "preReceiveScript", repository.preReceiveScripts); @@ -1111,8 +1111,18 @@ updateList(config, "indexBranch", repository.indexedBranches); // User Defined Properties for (Entry<String, String> singleProperty : repository.customFields.entrySet()) { config.setString(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION, singleProperty.getKey(), singleProperty.getValue()); if (repository.customFields != null) { if (repository.customFields.size() == 0) { // clear section config.unsetSection(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS); } else { for (Entry<String, String> property : repository.customFields.entrySet()) { // set field String key = property.getKey(); String value = property.getValue(); config.setString(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS, key, value); } } } try { @@ -1129,9 +1139,9 @@ return; } if (ArrayUtils.isEmpty(list)) { config.unset("gitblit", null, field); config.unset(Constants.CONFIG_GITBLIT, null, field); } else { config.setStringList("gitblit", null, field, list); config.setStringList(Constants.CONFIG_GITBLIT, null, field, list); } } tests/com/gitblit/tests/RepositoryModelTest.java
@@ -1,3 +1,19 @@ /* * Copyright 2012 John Crygier * Copyright 2012 gitblit.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.gitblit.tests; import static org.junit.Assert.assertEquals; @@ -17,28 +33,17 @@ public class RepositoryModelTest { private static String oldSection; private static String oldSubSection; private static boolean wasStarted = false; @BeforeClass public static void startGitBlit() throws Exception { wasStarted = GitBlitSuite.startGitblit() == false; oldSection = Constants.CUSTOM_FIELDS_PROP_SECTION; oldSubSection = Constants.CUSTOM_FIELDS_PROP_SUBSECTION; Constants.CUSTOM_FIELDS_PROP_SECTION = "RepositoryModelTest"; Constants.CUSTOM_FIELDS_PROP_SUBSECTION = "RepositoryModelTestSubSection"; } @AfterClass public static void stopGitBlit() throws Exception { if (wasStarted == false) GitBlitSuite.stopGitblit(); Constants.CUSTOM_FIELDS_PROP_SECTION = oldSection; Constants.CUSTOM_FIELDS_PROP_SUBSECTION = oldSubSection; } @Before @@ -46,9 +51,9 @@ Repository r = GitBlitSuite.getHelloworldRepository(); StoredConfig config = JGitUtils.readConfig(r); config.unsetSection(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION); config.setString(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION, "commitMessageRegEx", "\\d"); config.setString(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION, "anotherProperty", "Hello"); config.unsetSection(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS); config.setString(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS, "commitMessageRegEx", "\\d"); config.setString(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS, "anotherProperty", "Hello"); config.save(); } @@ -58,7 +63,7 @@ Repository r = GitBlitSuite.getHelloworldRepository(); StoredConfig config = JGitUtils.readConfig(r); config.unsetSection(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION); config.unsetSection(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS); config.save(); }