Skip to content

Commit 1e1b852

Browse files
committed
Preliminary implementation of server-side forking (issue 137)
The fork mechanism clones the repository , access restrictions, and other config options. The app has been updated throughout to handle personal repositories and to properly display origin/fork links. In order to fork a repository the user account must have the #fork role, the origin repository must permit forking, and the user account must have standard clone permissions to the repository. Because forking introduces a new user role no existing user accounts can automatically begin forking a repository. This is both a pro and a con. Since the fork has the same access restrictions as the origin repository, those who can access the origin may also access the fork. This is intentional to facilitate integration-manager workflow. The fork owner does have the power to completely change the access restrictions of his/her fork.
1 parent 0d531b1 commit 1e1b852

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1235
-301
lines changed

.project

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<projectDescription>
3-
<name>gitblit</name>
4-
<comment></comment>
5-
<projects>
6-
</projects>
7-
<buildSpec>
8-
<buildCommand>
9-
<name>org.eclipse.jdt.core.javabuilder</name>
10-
<arguments>
11-
</arguments>
12-
</buildCommand>
13-
<buildCommand>
14-
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
15-
<arguments>
16-
</arguments>
17-
</buildCommand>
18-
</buildSpec>
19-
<natures>
20-
<nature>org.eclipse.jdt.core.javanature</nature>
21-
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
22-
</natures>
23-
</projectDescription>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Gitblit</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
22+
</natures>
23+
</projectDescription>

docs/04_releases.mkd

+9-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@ If you are updating from an earlier release AND you have indexed branches with t
1717

1818
#### additions
1919

20-
- added support for X-Forwarded-Context for Apache subdomain proxy configurations (issue 135)
21-
- delete branch feature (issue 121, Github/ajermakovics)
22-
- added line links to blob view at the expense of zebra striping (issue 130)
23-
- added RedmineUserService (github/mallowlabs)
20+
- Added simple project pages. A project is a subfolder off the *git.repositoriesFolder*.
21+
- Added support for personal repositories. This builds on the simple project pages.
22+
Personal repositories are stored in *git.repositoriesFolder*/*~username*. Each user with personal repositories will have a user page, something like the GitHub profile page. Personal repositories have all the same features as common repositories.
23+
- Added support for server-side forking of a repository to a personal repository (issue 137)
24+
In order to fork a repository to a personal clone, the user account must have the *fork* permission **and** the repository must *allow forks*. The clone inherits the access restrictions of its origin. i.e. if Team A has access to the origin repository, then by default Team A also has access to the fork. This is to facilitate collaboration. However, the fork owner may change access to the fork and add/remove users/teams, etc as required.
25+
- Added support for X-Forwarded-Context for Apache subdomain proxy configurations (issue 135)
26+
- Delete branch feature (issue 121, Github/ajermakovics)
27+
- Added line links to blob view at the expense of zebra striping (issue 130)
28+
- Added RedmineUserService (github/mallowlabs)
2429

2530
#### changes
2631

docs/05_roadmap.mkd

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ This list is volatile.
2626
### IDEAS
2727

2828
* Gitblit: Re-use the EGit branch visualization table cell renderer as some sort of servlet
29-
* Gitblit: Support personal repositories (~username/repo)
3029
* Gitblit: diff should highlight inserted/removed fragment compared to original line
3130
* Gitblit: implement branch permission controls as Groovy pre-receive script.
3231
*Maintain permissions text file similar to a gitolite configuration file or svn authz file.*

resources/gitblit.css

+46
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ a:focus {
2020
outline: none;
2121
}
2222

23+
[class^="icon-"], [class*=" icon-"] a i {
24+
/* override for a links that look like bootstrap buttons */
25+
vertical-align: text-bottom;
26+
}
27+
2328
hr {
2429
margin-top: 10px;
2530
margin-bottom: 10px;
@@ -127,6 +132,47 @@ navbar div>ul .menu-dropdown li a:hover,.nav .menu-dropdown li a:hover,.navbar d
127132
font-weight: bold;
128133
}
129134

135+
.pageTitle {
136+
color: #888;
137+
font-size: 18px;
138+
line-height: 27px;
139+
}
140+
.pageTitle .project, .pageTitle .repository {
141+
font-family: Helvetica, arial, freesans, clean, sans-serif;
142+
font-size: 22px;
143+
}
144+
145+
.pageTitle .controls {
146+
font-size: 12px;
147+
}
148+
149+
.pageTitle .repository {
150+
font-weight: bold;
151+
}
152+
153+
.originRepository {
154+
font-family: Helvetica, arial, freesans, clean, sans-serif;
155+
color: #888;
156+
font-size: 12px;
157+
line-height: 14px;
158+
margin: 0px;
159+
}
160+
161+
.forkSource, .forkEntry {
162+
color: #888;
163+
}
164+
165+
.forkSource {
166+
font-size: 18px;
167+
line-height: 20px;
168+
padding: 5px 0px;
169+
}
170+
171+
.forkEntry {
172+
font-size: 14px;
173+
padding: 2px 0px;
174+
}
175+
130176
div.page_footer {
131177
clear: both;
132178
height: 17px;

src/com/gitblit/ConfigUserService.java

+4
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,9 @@ private synchronized void write() throws IOException {
750750
if (model.canAdmin) {
751751
roles.add(Constants.ADMIN_ROLE);
752752
}
753+
if (model.canFork) {
754+
roles.add(Constants.FORK_ROLE);
755+
}
753756
if (model.excludeFromFederation) {
754757
roles.add(Constants.NOT_FEDERATED_ROLE);
755758
}
@@ -858,6 +861,7 @@ protected synchronized void read() {
858861
Set<String> roles = new HashSet<String>(Arrays.asList(config.getStringList(
859862
USER, username, ROLE)));
860863
user.canAdmin = roles.contains(Constants.ADMIN_ROLE);
864+
user.canFork = roles.contains(Constants.FORK_ROLE);
861865
user.excludeFromFederation = roles.contains(Constants.NOT_FEDERATED_ROLE);
862866

863867
// repository memberships

src/com/gitblit/Constants.java

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class Constants {
4141
public static final String JGIT_VERSION = "JGit 2.1.0 (201209190230-r)";
4242

4343
public static final String ADMIN_ROLE = "#admin";
44+
45+
public static final String FORK_ROLE = "#fork";
4446

4547
public static final String NOT_FEDERATED_ROLE = "#notfederated";
4648

src/com/gitblit/FileUserService.java

+5
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ public UserModel getUserModel(String username) {
234234
// Permissions
235235
if (role.equalsIgnoreCase(Constants.ADMIN_ROLE)) {
236236
model.canAdmin = true;
237+
} else if (role.equalsIgnoreCase(Constants.FORK_ROLE)) {
238+
model.canFork = true;
237239
} else if (role.equalsIgnoreCase(Constants.NOT_FEDERATED_ROLE)) {
238240
model.excludeFromFederation = true;
239241
}
@@ -283,6 +285,9 @@ public boolean updateUserModel(String username, UserModel model) {
283285
if (model.canAdmin) {
284286
roles.add(Constants.ADMIN_ROLE);
285287
}
288+
if (model.canFork) {
289+
roles.add(Constants.FORK_ROLE);
290+
}
286291
if (model.excludeFromFederation) {
287292
roles.add(Constants.NOT_FEDERATED_ROLE);
288293
}

0 commit comments

Comments
 (0)