diff options
author | James Moger <james.moger@gitblit.com> | 2013-11-13 17:56:50 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-11-13 17:56:50 -0500 |
commit | c44dd099a432094a12131cf60dfc8a19f5aa8101 (patch) | |
tree | d71d6130a1bd5a85a3c5b764a28b5eeebcc97906 /src/test | |
parent | 064857d7b2a7e1a0c205dbecf7b5f147221898a2 (diff) | |
download | gitblit-c44dd099a432094a12131cf60dfc8a19f5aa8101.tar.gz gitblit-c44dd099a432094a12131cf60dfc8a19f5aa8101.zip |
Implement mirror executor (issue-5)
The mirror executor will fetch ref updates for repository mirrors. This
feature is disabled by default and can be enabled by setting
git.enableMirroring=true. The period between update checks is
configurable, but it is global. An individual rpeository may not set
it's own update schedule.
Requirements:
1. you must manually clone the repository using native git
git clone --mirror git://somewhere.com/myrepo.git
2. the "origin" remote must be the mirror source
3. the "origin" repository must be accessible without authentication OR
the credentials must be embedded in the origin url (not recommended)
Notes:
1. "origin" SSH urls are untested and not likely to work
2. mirrors cloned while Gitblit is running are likely to require
clearing the gitblit cache (link on the repositories page of an
administrator account)
3. Gitblit will automatically repair any invalid fetch refspecs with a
"//" sequence.
Change-Id: I4bbe3fb2df106366ae4c2313596d0fab0dfcac46
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/com/gitblit/tests/PermissionsTest.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/java/com/gitblit/tests/PermissionsTest.java b/src/test/java/com/gitblit/tests/PermissionsTest.java index 942811d5..42ef9935 100644 --- a/src/test/java/com/gitblit/tests/PermissionsTest.java +++ b/src/test/java/com/gitblit/tests/PermissionsTest.java @@ -2878,4 +2878,22 @@ public class PermissionsTest extends Assert { assertEquals("user has wrong permission!", AccessPermission.CLONE, user.getRepositoryPermission(repo).permission); assertEquals("team has wrong permission!", AccessPermission.CLONE, team.getRepositoryPermission(repo).permission); } + + @Test + public void testIsMirror() throws Exception { + RepositoryModel repo = new RepositoryModel("somerepo.git", null, null, new Date()); + repo.authorizationControl = AuthorizationControl.NAMED; + repo.accessRestriction = AccessRestrictionType.NONE; + + UserModel user = new UserModel("test"); + TeamModel team = new TeamModel("team"); + + assertEquals("user has wrong permission!", AccessPermission.REWIND, user.getRepositoryPermission(repo).permission); + assertEquals("team has wrong permission!", AccessPermission.REWIND, team.getRepositoryPermission(repo).permission); + + // set repo to be a mirror, pushes prohibited + repo.isMirror = true; + assertEquals("user has wrong permission!", AccessPermission.CLONE, user.getRepositoryPermission(repo).permission); + assertEquals("team has wrong permission!", AccessPermission.CLONE, team.getRepositoryPermission(repo).permission); + } } |