From a5e762ba4ab82f0c6ef71d853c5103f19bbf8e22 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Thu, 11 Oct 2012 08:10:20 -0400 Subject: [PATCH] Tweak canFork description --- src/com/gitblit/models/RepositoryModel.java | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/com/gitblit/models/RepositoryModel.java b/src/com/gitblit/models/RepositoryModel.java index a28536d..914523d 100644 --- a/src/com/gitblit/models/RepositoryModel.java +++ b/src/com/gitblit/models/RepositoryModel.java @@ -88,7 +88,8 @@ this.accessRestriction = AccessRestrictionType.NONE; this.authorizationControl = AuthorizationControl.NAMED; this.federationSets = new ArrayList<String>(); - this.federationStrategy = FederationStrategy.FEDERATE_THIS; + this.federationStrategy = FederationStrategy.FEDERATE_THIS; + this.projectPath = StringUtils.getFirstPathElement(name); } public List<String> getLocalBranches() { @@ -148,6 +149,14 @@ return StringUtils.compareRepositoryNames(name, o.name); } + public boolean isFork() { + return !StringUtils.isEmpty(originRepository); + } + + public boolean isOwner(String username) { + return owner != null && username != null && owner.equalsIgnoreCase(username); + } + public boolean isPersonalRepository() { return !StringUtils.isEmpty(projectPath) && projectPath.charAt(0) == '~'; } @@ -167,8 +176,8 @@ clone.projectPath = StringUtils.getFirstPathElement(cloneName); clone.isBare = true; clone.description = description; - clone.accessRestriction = accessRestriction; - clone.authorizationControl = authorizationControl; + clone.accessRestriction = AccessRestrictionType.PUSH; + clone.authorizationControl = AuthorizationControl.NAMED; clone.federationStrategy = federationStrategy; clone.showReadme = showReadme; clone.showRemoteBranches = false; -- Gitblit v1.9.1