mrbytes
2013-07-19 1c5a45ebe6285b0f6a9b8f50d5467baa11a1ff63
Merge branch 'master' of https://github.com/gitblit/gitblit
2 files added
9 files modified
291 ■■■■■ changed files
build.xml 4 ●●●● patch | view | raw | blame | history
releases.moxie 18 ●●●● patch | view | raw | blame | history
src/main/java/com/gitblit/GitBlit.java 11 ●●●● patch | view | raw | blame | history
src/main/java/com/gitblit/git/ReceiveHook.java 17 ●●●●● patch | view | raw | blame | history
src/main/java/com/gitblit/utils/CommitCache.java 17 ●●●●● patch | view | raw | blame | history
src/main/java/com/gitblit/wicket/GitBlitWebApp_nl.properties 61 ●●●●● patch | view | raw | blame | history
src/main/java/com/gitblit/wicket/GitBlitWebApp_zh_CN.properties 64 ●●●●● patch | view | raw | blame | history
src/main/java/com/gitblit/wicket/pages/BasePage.html 1 ●●●● patch | view | raw | blame | history
src/test/java/com/gitblit/tests/GitBlitSuite.java 2 ●●● patch | view | raw | blame | history
src/test/java/com/gitblit/tests/Issue0271Test.java 76 ●●●●● patch | view | raw | blame | history
src/test/resources/issue0271.conf 20 ●●●●● patch | view | raw | blame | history
build.xml
@@ -280,6 +280,7 @@
        <mx:genjar destfile="${webinf}/lib/gitblit.jar" includeresources="false" excludeclasspathjars="true">
            <!-- Specify all web.xml servlets and filters -->
            <class name="com.gitblit.GitBlit" />
            <class name="com.gitblit.Keys" />
            <class name="com.gitblit.DownloadZipFilter" />
            <class name="com.gitblit.DownloadZipServlet" />
            <class name="com.gitblit.EnforceAuthenticationFilter" />
@@ -335,6 +336,7 @@
        <mx:genjar tag="" includeresources="false" excludeClasspathJars="true"
            destfile="${project.targetDirectory}/fedclient.jar">
            <mainclass name="com.gitblit.FederationClient" />
            <class name="com.gitblit.Keys" />
            <launcher paths="ext" />
            <resource file="${project.compileOutputDirectory}/log4j.properties" />
        </mx:genjar>
@@ -395,6 +397,7 @@
        <!-- Gitblit classes -->
        <mx:genjar destfile="${webinf}/lib/gitblit.jar" includeresources="false" excludeclasspathjars="true">
            <class name="com.gitblit.Keys" />
            <!-- Specify all web.xml servlets and filters -->
            <class name="com.gitblit.GitBlit" />
            <class name="com.gitblit.DownloadZipFilter" />
@@ -552,6 +555,7 @@
            </resource>
            <mainclass name="com.gitblit.authority.Launcher" />
            <class name="com.gitblit.Keys" />
            <manifest>
                <attribute name="SplashScreen-Image" value="splash.png" />
            </manifest>
releases.moxie
@@ -5,17 +5,29 @@
    title: ${project.name} ${project.version} released
    id: ${project.version}
    date: ${project.buildDate}
    note: ~
    note: ''
          If you have forked repositories and your are upgrading from 1.2.x to 1.3.x, please DO NOT RELOCATE your repositories folder when running 1.3.x the first time.  Gitblit will update forked repository configs on the first execution and it is critical that ${git.repositoriesFolder} points to the same location used by 1.2.x.
          ''
    html: ~
    text: ~
    security: ~
    fixes:
    - Gitblit-as-viewer with no repository urls failed to display summary page (issue 269)
    - Fixed missing model class dependencies in Gitblit Manager build
    changes: ~
    - Fix for IE10 compatability mode
    - Reset dashboard and activity commit cache on branch REWIND or DELETE
    - Fixed bug with adding new local users with external authentication
    changes:
    - updated Chinese translation
    - updated Dutch translation
    additions: ~
    dependencyChanges: ~
    contributors: ~
    contributors:
    - Rainer Alföldi
    - Liyu Wang
    - Jeroen Baten
    - James Moger
    - Stardrad Yin
}
#
src/main/java/com/gitblit/GitBlit.java
@@ -84,6 +84,7 @@
import com.gitblit.Constants.AccessPermission;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.Constants.AccountType;
import com.gitblit.Constants.AuthenticationType;
import com.gitblit.Constants.AuthorizationControl;
import com.gitblit.Constants.FederationRequest;
@@ -695,12 +696,12 @@
    public boolean supportsCredentialChanges(UserModel user) {
        if (user == null) {
            return false;
        } else if (!Constants.EXTERNAL_ACCOUNT.equals(user.password)) {
            // credentials likely maintained by Gitblit
            return userService.supportsCredentialChanges();
        } else if (AccountType.LOCAL.equals(user.accountType)) {
            // local account, we can change credentials
            return true;
        } else {
            // credentials are externally maintained
            return false;
            // external account, ask user service
            return userService.supportsCredentialChanges();
        }
    }
src/main/java/com/gitblit/git/ReceiveHook.java
@@ -36,6 +36,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.gitblit.Constants;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
@@ -44,6 +45,7 @@
import com.gitblit.models.UserModel;
import com.gitblit.utils.ArrayUtils;
import com.gitblit.utils.ClientLogger;
import com.gitblit.utils.CommitCache;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.RefLogUtils;
import com.gitblit.utils.StringUtils;
@@ -186,6 +188,21 @@
                return;
            }
        }
        // reset branch commit cache on REWIND and DELETE
        for (ReceiveCommand cmd : commands) {
            String ref = cmd.getRefName();
            if (ref.startsWith(Constants.R_HEADS)) {
                switch (cmd.getType()) {
                case UPDATE_NONFASTFORWARD:
                case DELETE:
                    CommitCache.instance().clear(repository.name, ref);
                    break;
                default:
                    break;
                }
            }
        }
        Set<String> scripts = new LinkedHashSet<String>();
        scripts.addAll(GitBlit.self().getPreReceiveScriptsInherited(repository));
src/main/java/com/gitblit/utils/CommitCache.java
@@ -110,6 +110,23 @@
    }
    
    /**
     * Clears the commit cache for a specific branch of a specific repository.
     *
     * @param repositoryName
     * @param branch
     */
    public void clear(String repositoryName, String branch) {
        String repoKey = repositoryName.toLowerCase();
        ObjectCache<List<RepositoryCommit>> repoCache = cache.get(repoKey);
        if (repoCache != null) {
            List<RepositoryCommit> commits = repoCache.remove(branch.toLowerCase());
            if (!ArrayUtils.isEmpty(commits)) {
                logger.info(MessageFormat.format("{0}:{1} commit cache cleared", repositoryName, branch));
            }
        }
    }
    /**
     * Get all commits for the specified repository:branch that are in the cache.
     * 
     * @param repositoryName
src/main/java/com/gitblit/wicket/GitBlitWebApp_nl.properties
@@ -441,5 +441,64 @@
gb.siteName = site naam
gb.siteNameDescription = korte, verduidelijkende naam van deze server
gb.excludeFromActivity = sluit uit van activiteitspagina
gb.isSparkleshared = repository is Sparkleshared
gb.owners = owners
gb.sessionEnded = Sessie is afgesloten
gb.closeBrowser = Sluit de browser af om de sessie helemaal te beeindigen.
gb.closeBrowser = Sluit de browser af om de sessie helemaal te beeindigen.
gb.doesNotExistInTree = {0} bestaat niet in de tree {1}
gb.enableIncrementalPushTags = enable incrementele push tags
gb.useIncrementalPushTagsDescription = bij een push, automatisch tag elke branch tip met een incrementeel revisie nummer
gb.incrementalPushTagMessage = Auto-tagged [{0}] branch door een push
gb.externalPermissions = {0} toegangsrechten worden exter beheert
gb.viewAccess = U heeft geen Gitblit lees- of schrijfrechten
gb.overview = overview
gb.dashboard = dashboard
gb.monthlyActivity = maandelijkse activiteit
gb.myProfile = mijn profiel
gb.compare = vergelijk
gb.manual = manual
gb.from = van
gb.to = aan
gb.at = op
gb.of = van
gb.in = in
gb.moreChanges = alle wijzigingen...
gb.pushedNCommitsTo = push {0} commits naar
gb.pushedOneCommitTo = push 1 commit naar
gb.commitsTo = {0} commits naar
gb.oneCommitTo = 1 commit naar
gb.byNAuthors = door {0} auteurs
gb.byOneAuthor = door {0}
gb.viewComparison = toon vergelijking van deze {0} commits \u00bb
gb.nMoreCommits = {0} commits \u00bb
gb.oneMoreCommit = 1 commit \u00bb
gb.pushedNewTag = push nieuwe tag
gb.createdNewTag = nieuww tag gemaakt
gb.deletedTag = tag verwijderd
gb.pushedNewBranch = push neuwe branch
gb.createdNewBranch = nieuwe branch gemaakt
gb.deletedBranch = branch verwijderd
gb.createdNewPullRequest = pull verzoek gemaakt
gb.mergedPullRequest = pull verzoek gemerged
gb.rewind = REWIND
gb.star = markeer
gb.unstar = demarkeer
gb.stargazers = sterrenkijkers
gb.starredRepositories = repositories met een ster
gb.failedToUpdateUser = Bijwerken gebruikersaccount niet gelukt!
gb.myRepositories = mijn repositories
gb.noActivity = er is geen activiteit geweest in de laatste {0} dagen
gb.findSomeRepositories = vind repositories
gb.metricAuthorExclusions = author metric exclusions
gb.myDashboard = mijn dashboard
gb.failedToFindAccount = kan gebruikersaccount ''{0}'' niet vinden
gb.reflog = reflog
gb.active = actief
gb.starred = gemarkeerd
gb.owned = eigendom
gb.starredAndOwned = gemarkeerd & eigendom
gb.reviewPatchset = review {0} patchset {1}
gb.todaysActivityStats = vandaag / {1} commits door {2} auteurs
gb.todaysActivityNone = vandaag / geen
gb.noActivityToday = er is vandaag geen activiteit geweest
gb.anonymousUser= anoniem
src/main/java/com/gitblit/wicket/GitBlitWebApp_zh_CN.properties
@@ -441,6 +441,64 @@
gb.siteName = \u7f51\u7ad9\u540d\u79f0
gb.siteNameDescription = \u60a8\u7684\u670d\u52a1\u5668\u7684\u7b80\u8981\u63cf\u8ff0
gb.excludeFromActivity = \u4ece\u6d3b\u52a8\u9875\u9762\u6392\u9664
gb.isSparkleshared = repository is Sparkleshared
gb.sessionEnded = Session has been closed
gb.closeBrowser = Please close the browser to properly end the session.
gb.isSparkleshared = \u7248\u672c\u5e93\u5df2\u901a\u8fc7Sparkleshare\u5b8c\u6210\u540c\u6b65
gb.owners = \u62e5\u6709\u8005
gb.sessionEnded = \u4f1a\u8bdd\u5df2\u5173\u95ed
gb.closeBrowser = \u8bf7\u5173\u95ed\u6d4f\u89c8\u5668\u4ee5\u4fbf\u6b63\u5e38\u5173\u95ed\u4f1a\u8bdd\u3002
gb.doesNotExistInTree = {1} \u76ee\u5f55\u4e2d\u4e0d\u5b58\u5728 {0}
gb.enableIncrementalPushTags = \u5141\u8bb8\u9012\u589e\u5f0f\u63a8\u9001\u6807\u7b7e
gb.useIncrementalPushTagsDescription = \u6bcf\u6b21\u63a8\u9001\u65f6\uff0c\u81ea\u52a8\u4e3a\u6bcf\u4e2a\u5206\u652f\u6dfb\u52a0\u9012\u589e\u7684revision\u7f16\u53f7
gb.incrementalPushTagMessage = \u63a8\u9001\u65f6\u81ea\u52a8\u4e3a\u5206\u652f [{0}] \u6dfb\u52a0\u6807\u7b7e
gb.externalPermissions = {0} \u7684\u8bbf\u95ee\u6743\u9650\u5c5e\u4e8e\u5916\u90e8\u63a7\u5236
gb.viewAccess = \u60a8\u6ca1\u6709 Gitblit \u8bfb\u6216\u5199\u7684\u6743\u9650
gb.overview = \u603b\u89c8
gb.dashboard = \u516c\u544a\u677f
gb.monthlyActivity = \u6708\u5ea6\u6d3b\u52a8
gb.myProfile = \u7528\u6237\u4e2d\u5fc3
gb.compare = \u5bf9\u6bd4
gb.manual = \u624b\u518c
gb.from = from
gb.to = to
gb.at = at
gb.of = of
gb.in = in
gb.moreChanges = \u6240\u6709\u53d8\u52a8...
gb.pushedNCommitsTo = \u5df2\u63a8\u9001 {0} \u6b21\u81f3
gb.pushedOneCommitTo = \u5df2\u63a8\u9001 1 \u6b21\u81f3
gb.commitsTo = {0} \u6b21\u63a8\u9001\u81f3
gb.oneCommitTo = 1 \u6b21\u63a8\u9001\u81f3
gb.byNAuthors = \u6765\u81ea {0}
gb.byOneAuthor = \u6765\u81ea {0}
gb.viewComparison = \u5bf9\u6bd4\u4ee5\u4e0b {0} \u6b21\u63d0\u4ea4\u5185\u5bb9 \xbb
gb.nMoreCommits = \u5176\u4ed6 {0} \u6b21\u63d0\u4ea4\xbb
gb.oneMoreCommit = \u5176\u4ed6 1 \u6b21\u63d0\u4ea4 \xbb
gb.pushedNewTag = \u63a8\u9001\u65b0\u6807\u7b7e
gb.createdNewTag = \u521b\u5efa\u65b0\u6807\u7b7e
gb.deletedTag = \u5220\u9664\u6807\u7b7e
gb.pushedNewBranch = \u63a8\u9001\u65b0\u5206\u652f
gb.createdNewBranch = \u521b\u5efa\u65b0\u5206\u652f
gb.deletedBranch = \u5df2\u5220\u9664\u5206\u652f
gb.createdNewPullRequest = \u521b\u5efa pull request
gb.mergedPullRequest = \u5408\u5e76 pull request
gb.rewind = REWIND
gb.star = \u5173\u6ce8
gb.unstar = \u53d6\u6d88\u5173\u6ce8
gb.stargazers = stargazers
gb.starredRepositories = \u5df2\u5173\u6ce8\u7248\u672c\u5e93
gb.failedToUpdateUser = \u66f4\u65b0\u7528\u6237\u8d26\u6237\u4fe1\u606f\u5931\u8d25!
gb.myRepositories = \u6211\u7684\u7248\u672c\u5e93
gb.noActivity = \u6700\u8fd1 {0} \u5929\u5185\u6ca1\u6709\u4efb\u4f55\u6d3b\u52a8
gb.findSomeRepositories = \u5bfb\u627e\u7248\u672c\u5e93
gb.metricAuthorExclusions = author metric exclusions
gb.myDashboard = \u6211\u7684\u516c\u544a\u677f
gb.failedToFindAccount = \u5bfb\u627e\u8d26\u6237 ''{0}'' \u5931\u8d25
gb.reflog = reflog
gb.active = \u6d3b\u52a8
gb.starred = \u5df2\u5173\u6ce8
gb.owned = \u5c5e\u4e8e\u60a8
gb.starredAndOwned = \u5df2\u5173\u6ce8 & \u5c5e\u4e8e\u60a8
gb.reviewPatchset = review {0} patchset {1}
gb.todaysActivityStats = \u4eca\u5929 / \u6765\u81ea {2} \u7684 {1} \u6b21\u63d0\u4ea4
gb.todaysActivityNone = \u4eca\u5929 / \u65e0
gb.noActivityToday = \u4eca\u5929\u6ca1\u6709\u4efb\u4f55\u6d3b\u52a8
gb.anonymousUser = \u533f\u540d
src/main/java/com/gitblit/wicket/pages/BasePage.html
@@ -8,6 +8,7 @@
    <!-- Head -->
    <wicket:head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
           <title wicket:id="title">[page title]</title>
        <link rel="icon" href="gitblt-favicon.png" type="image/png" />
        
src/test/java/com/gitblit/tests/GitBlitSuite.java
@@ -60,7 +60,7 @@
        DiffUtilsTest.class, MetricUtilsTest.class, TicgitUtilsTest.class, X509UtilsTest.class,
        GitBlitTest.class, FederationTests.class, RpcTests.class, GitServletTest.class, GitDaemonTest.class,
        GroovyScriptTest.class, LuceneExecutorTest.class, IssuesTest.class, RepositoryModelTest.class,
        FanoutServiceTest.class, Issue0259Test.class })
        FanoutServiceTest.class, Issue0259Test.class, Issue0271Test.class })
public class GitBlitSuite {
    public static final File REPOSITORIES = new File("data/git");
src/test/java/com/gitblit/tests/Issue0271Test.java
New file
@@ -0,0 +1,76 @@
/*
 * Copyright 2013 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 java.io.File;
import org.junit.Assert;
import org.junit.Test;
import com.gitblit.ConfigUserService;
import com.gitblit.Constants.AccessPermission;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.UserModel;
/**
 * https://code.google.com/p/gitblit/issues/detail?id=271
 *
 * Reported Problem:
 * Inherited team permissions are incorrect.
 *
 * @see src/test/resources/issue0270.conf
 *
 * @author James Moger
 *
 */
public class Issue0271Test extends Assert {
    RepositoryModel repo(String name, AccessRestrictionType restriction) {
        RepositoryModel repo = new RepositoryModel();
        repo.name = name;
        repo.accessRestriction = restriction;
        return repo;
    }
    /**
     * Test the provided users.conf file for expected access permissions.
     *
     * @throws Exception
     */
    @Test
    public void testFile() throws Exception {
        File realmFile = new File("src/test/resources/issue0271.conf");
        ConfigUserService service = new ConfigUserService(realmFile);
        RepositoryModel test = repo("test.git", AccessRestrictionType.VIEW);
        RepositoryModel teama_test = repo("teama/test.git", AccessRestrictionType.VIEW);
        UserModel a = service.getUserModel("a");
        UserModel b = service.getUserModel("b");
        UserModel c = service.getUserModel("c");
        // assert V for test.git
        assertEquals(AccessPermission.VIEW, a.getRepositoryPermission(test).permission);
        assertEquals(AccessPermission.VIEW, b.getRepositoryPermission(test).permission);
        assertEquals(AccessPermission.VIEW, c.getRepositoryPermission(test).permission);
        // assert expected permissions for teama/test.git
        assertEquals(AccessPermission.VIEW, a.getRepositoryPermission(teama_test).permission);
        assertEquals(AccessPermission.PUSH, b.getRepositoryPermission(teama_test).permission);
        assertEquals(AccessPermission.CREATE, c.getRepositoryPermission(teama_test).permission);
    }
}
src/test/resources/issue0271.conf
New file
@@ -0,0 +1,20 @@
[user "A"]
    password = apassword
    role = "#none"
[user "B"]
    password = apassword
    role = "#none"
[user "C"]
    password = apassword
    role = "#none"
    repository = RWC:teama/.*
[team "developers"]
    role = "#none"
    repository = V:.*
    user = A
    user = B
    user = C
[team "teama"]
    repository = RW:teama/.*
    user = B
    user = C