gitolite/t/wild-1.t

127 lines
3.8 KiB
Perl
Raw Normal View History

2012-03-18 05:20:24 +01:00
#!/usr/bin/perl
use strict;
use warnings;
# this is hardcoded; change it if needed
use lib "src";
use Gitolite::Test;
2012-03-19 11:33:59 +01:00
# wild repos - part 1
2012-03-18 05:20:24 +01:00
# ----------------------------------------------------------------------
2012-03-18 13:35:27 +01:00
try "plan 66";
2012-03-18 05:20:24 +01:00
confreset;confadd '
@prof = u1
@TAs = u2 u3
@students = u4 u5 u6
@gfoo = foo/CREATOR/a[0-9][0-9]
repo @gfoo
C = @all
RW+ = CREATOR
RW = WRITERS @TAs
R = READERS @prof
';
try "ADMIN_PUSH set1; !/FATAL/" or die text();
try "
# reasonably complex setup; we'll do everything from one repo though
cd ..
# u1 create success
2012-03-18 13:35:27 +01:00
glt clone u1 file:///foo/u1/a01; ok; /Initialized empty Git repository in .*/foo/u1/a01.git//
2012-03-18 05:20:24 +01:00
# u2 create success
2012-03-18 13:35:27 +01:00
glt clone u2 file:///foo/u2/a02; ok; /Initialized empty Git repository in .*/foo/u2/a02.git//
2012-03-18 05:20:24 +01:00
# u4 tries to create u2 repo
2012-03-18 13:35:27 +01:00
glt clone u4 file:///foo/u2/a12; !ok; /R any foo/u2/a12 u4 DENIED by fallthru/
2012-03-18 05:20:24 +01:00
# line anchored regexes
2012-03-18 13:35:27 +01:00
glt clone u4 file:///foo/u4/a1234; !ok; /R any foo/u4/a1234 u4 DENIED by fallthru/
2012-03-18 05:20:24 +01:00
# u4 tries to create his own repo
2012-03-18 13:35:27 +01:00
glt clone u4 file:///foo/u4/a12; ok; /Initialized empty Git repository in .*/foo/u4/a12.git//
/warning: You appear to have cloned an empty repository./
2012-03-18 05:20:24 +01:00
# u4 push success
cd a12
2012-03-18 13:35:27 +01:00
tc p-728 p-729 p-730 p-731; ok
glt push u4 origin master; ok; /To file:///foo/u4/a12/
/\\* \\[new branch\\] master -> master/
2012-03-18 05:20:24 +01:00
# u1 clone success
cd ..
2012-03-18 13:35:27 +01:00
glt clone u1 file:///foo/u4/a12 u1a12; ok; /Cloning into 'u1a12'.../
2012-03-18 05:20:24 +01:00
# u1 push fail
cd u1a12
2012-03-18 13:35:27 +01:00
tc m-778 m-779; ok;
glt push u1 origin; !ok; /W any foo/u4/a12 u1 DENIED by fallthru/
2012-03-18 05:20:24 +01:00
# u2 clone success
cd ..
2012-03-18 13:35:27 +01:00
glt clone u2 file:///foo/u4/a12 u2a12; ok; /Cloning into 'u2a12'.../
2012-03-18 05:20:24 +01:00
# u2 push success
cd u2a12
2012-03-18 13:35:27 +01:00
tc s-708 s-709; ok;
glt push u2 origin; ok; /To file:///foo/u4/a12/
/master -> master/
2012-03-18 05:20:24 +01:00
# u2 rewind fail
2012-03-18 13:35:27 +01:00
glt push u2 -f origin master^:master; !ok; /\\+ refs/heads/master foo/u4/a12 u2 DENIED by fallthru/
reject
2012-03-18 05:20:24 +01:00
# u4 pull to sync up
cd ../a12
2012-03-18 13:35:27 +01:00
glt pull u4; ok; /Fast-forward/
/From file:///foo/u4/a12/
/master -> origin/master/
2012-03-18 05:20:24 +01:00
# u4 rewind success
2012-03-18 13:35:27 +01:00
git reset --hard HEAD^; ok
glt push u4 -f; ok; /To file:///foo/u4/a12/
/\\+ .* master -> master \\(forced update\\)/
2012-03-18 05:20:24 +01:00
# u5 clone fail
cd ..
2012-03-18 13:35:27 +01:00
glt clone u5 file:///foo/u4/a12 u5a12; !ok; /R any foo/u4/a12 u5 DENIED by fallthru/
2012-03-18 05:20:24 +01:00
glt perms u4 foo/u4/a12 + READERS u5
glt perms u4 foo/u4/a12 + WRITERS u6
glt perms u4 -l foo/u4/a12
";
cmp 'READERS u5
WRITERS u6
';
try "
# u5 clone success
2012-03-18 13:35:27 +01:00
glt clone u5 file:///foo/u4/a12 u5a12; ok; /Cloning into 'u5a12'.../
2012-03-18 05:20:24 +01:00
# u5 push fail
cd u5a12
2012-03-18 13:35:27 +01:00
tc y-743 y-744; ok
glt push u5; !ok; /W any foo/u4/a12 u5 DENIED by fallthru/
2012-03-18 05:20:24 +01:00
# u6 clone success
cd ..
2012-03-18 13:35:27 +01:00
glt clone u6 file:///foo/u4/a12 u6a12; ok; /Cloning into 'u6a12'.../
2012-03-18 05:20:24 +01:00
# u6 push success
cd u6a12
2012-03-18 13:35:27 +01:00
tc k-68 k-69; ok
glt push u6 file:///foo/u4/a12; ok; /To file:///foo/u4/a12/
/master -> master/
2012-03-18 05:20:24 +01:00
# u6 rewind fail
glt push u6 -f file:///foo/u4/a12 master^:master
2012-03-18 13:35:27 +01:00
!ok; /\\+ refs/heads/master foo/u4/a12 u6 DENIED by fallthru/
reject
2012-03-18 05:20:24 +01:00
";