summaryrefslogtreecommitdiffstats
path: root/t/sequence.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 09:55:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 09:55:51 +0000
commit7685305e1f82212323ec32a321b1f5c623751b6c (patch)
treea1af617672e26aee4c1031a3aa83e8ff08f6a0a5 /t/sequence.t
parentInitial commit. (diff)
downloadgitolite3-upstream.tar.xz
gitolite3-upstream.zip
Adding upstream version 3.6.12.upstream/3.6.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/sequence.t')
-rwxr-xr-xt/sequence.t116
1 files changed, 116 insertions, 0 deletions
diff --git a/t/sequence.t b/t/sequence.t
new file mode 100755
index 0000000..8d66d03
--- /dev/null
+++ b/t/sequence.t
@@ -0,0 +1,116 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+# this is hardcoded; change it if needed
+use lib "src/lib";
+use Gitolite::Test;
+
+# uhh, seems to be another rule sequence test
+# ----------------------------------------------------------------------
+
+try "plan 48";
+
+confreset;confadd '
+ @staff = u1 u2 u3
+ @gfoo = foo/CREATOR/..*
+ repo @gfoo
+ C = u1
+ RW+ = CREATOR
+ RW = WRITERS
+ - = @staff
+';
+
+try "ADMIN_PUSH set1; !/FATAL/" or die text();
+
+try "
+ cd ..
+ glt clone u1 file:///foo/u1/bar; ok
+ /Initialized empty Git repository in .*/foo/u1/bar.git//
+
+ cd bar
+ tc p-906
+ glt push u1 origin master
+ /To file:///foo/u1/bar/
+ /\\[new branch\\] master -> master/
+ echo WRITERS u2 | glt perms u1 -c foo/u1/bar
+ glt perms u1 foo/u1/bar -l
+ /WRITERS u2/
+ # expand
+ glt info u2
+ /R W *\tfoo/u1/bar/
+ /R W *\ttesting/
+
+ # push
+ cd ..
+ glt clone u2 file:///foo/u1/bar u2bar
+ /Cloning into 'u2bar'.../
+ cd u2bar
+ tc p-222
+ glt push u2
+ /master -> master/
+ !/DENIED/
+ !/failed to push/
+";
+
+confreset;confadd '
+ @staff = u1 u2 u3
+ @gfoo = foo/CREATOR/..*
+ repo @gfoo
+ C = u1
+ RW+ = CREATOR
+ - = @staff
+ RW = WRITERS
+ R = READERS
+';
+
+try "ADMIN_PUSH set1; !/FATAL/" or die text();
+
+try "
+ cd ..
+ rm -rf bar u2bar
+ glt clone u1 file:///foo/u1/bar; ok
+ /Initialized empty Git repository in .*/foo/u1/bar.git//
+
+ cd bar
+ tc p-906
+ glt push u1 origin master
+ /To file:///foo/u1/bar/
+ /\\[new branch\\] master -> master/
+ echo WRITERS u2 | glt perms u1 -c foo/u1/bar
+ glt perms u1 foo/u1/bar -l
+ /WRITERS u2/
+ # expand
+ glt info u2
+ !/R W *\tfoo/u1/baz/
+ /R W *\tfoo/u1/bar/
+ /R W *\ttesting/
+
+ # push
+ cd ..
+ glt clone u2 file:///foo/u1/bar u2bar
+ /Cloning into 'u2bar'.../
+ cd u2bar
+ tc p-222
+ glt push u2
+ !ok
+ reject
+ /W refs/heads/master foo/u1/bar u2 DENIED by refs/\\.\\*/
+
+ # auto-create using perms fail
+ echo READERS u5 | glt perms u4 -c foo/u4/baz
+ !/Initialized empty Git repository in .*/foo/u4/baz.git/
+ /FATAL: repo does not exist, or you are not authorised/
+
+ # auto-create using perms
+ echo READERS u2 | glt perms u1 -c foo/u1/baz
+ /Initialized empty Git repository in .*/foo/u1/baz.git/
+
+ glt perms u1 foo/u1/baz -l
+ /READERS u2/
+ # expand
+ glt info u2
+ /R *\tfoo/u1/baz/
+ /R W *\tfoo/u1/bar/
+ /R W *\ttesting/
+";