diff options
author | Sitaram Chamarty <sitaram@atc.tcs.com> | 2013-03-03 18:56:41 +0530 |
---|---|---|
committer | Sitaram Chamarty <sitaram@atc.tcs.com> | 2013-03-05 11:55:59 +0530 |
commit | 79714c9c85d1321e6f4b0b3a3617bdb3503a98e1 (patch) | |
tree | 6347f476fb3e95ab08e7867279c8c97037f73af4 /t | |
parent | rc file format change: some inline doc/help text fixups (diff) | |
download | gitolite-gentoo-79714c9c85d1321e6f4b0b3a3617bdb3503a98e1.tar.gz gitolite-gentoo-79714c9c85d1321e6f4b0b3a3617bdb3503a98e1.tar.bz2 gitolite-gentoo-79714c9c85d1321e6f4b0b3a3617bdb3503a98e1.zip |
refex-expr
Diffstat (limited to 't')
-rwxr-xr-x | t/refex-expr-test-1 | 62 | ||||
-rwxr-xr-x | t/refex-expr-test-2 | 60 | ||||
-rwxr-xr-x | t/refex-expr-test-3 | 55 | ||||
-rwxr-xr-x | t/refex-expr-test-9 | 107 |
4 files changed, 284 insertions, 0 deletions
diff --git a/t/refex-expr-test-1 b/t/refex-expr-test-1 new file mode 100755 index 0000000..1372a1e --- /dev/null +++ b/t/refex-expr-test-1 @@ -0,0 +1,62 @@ +#!/bin/bash + +# not part of the official test suite (yet); just some q&d testing + +# to be run from ~/gitolite as ./$0 + +set -e +exec 3>&2 +exec > /dev/null +exec 2> /dev/null +print2() { echo -n "$@" >&3; } +say2() { echo "$@" >&3; } +die() { echo FATAL: "$@" >&3; exit 1; } + +export od=$PWD +export tmp=$(mktemp -d) +echo $tmp >&3 +trap "rm -rf $tmp" 0 +cd $tmp + +print2 setting up... +( cd $od; t/reset ) +echo "push @{ \$RC{ENABLE} }, 'refex-expr';" >> ~/.gitolite.rc +cat <<EOF >> ~/.gitolite/conf/gitolite.conf + +repo r1 + RW+ = u1 u2 # line 1 + + RW+ master = u3 u4 # line 2 + RW+ = u3 u4 # line 3 + RW+ VREF/NAME/Makefile = u3 u4 # line 4 + - master and VREF/NAME/Makefile = u3 u4 # line 5 + +EOF +gitolite setup +say2 done + +# ---------------------------------------------------------------------- + +rm -rf u1 +git clone u1:r1 u1 +cd u1 +tsh 'tc f1' +git push u1:r1 master +tsh 'tc f2' +git push u2:r1 master +tsh 'tc f3' +git push u3:r1 master +tsh 'tc f4' +git push u4:r1 master +say2 everyone master no Makefile + +tsh 'tc f5 Makefile' +git push u1:r1 master +tsh 'tc f5 Makefile' +git push u1:r1 master:m1 +say2 u1 Makefile master + +tsh 'tc f5 Makefile' +git push u3:r1 master && die u3 r1 master should have failed +git push u3:r1 master:m2 +say2 u3 Makefile master fail m2 pass diff --git a/t/refex-expr-test-2 b/t/refex-expr-test-2 new file mode 100755 index 0000000..773e42c --- /dev/null +++ b/t/refex-expr-test-2 @@ -0,0 +1,60 @@ +#!/bin/bash + +# not part of the official test suite (yet); just some q&d testing + +# to be run from ~/gitolite as ./$0 + +set -e +exec 3>&2 +exec > /dev/null +exec 2> /dev/null +print2() { echo -n "$@" >&3; } +say2() { echo "$@" >&3; } +die() { echo FATAL: "$@" >&3; exit 1; } + +export od=$PWD +export tmp=$(mktemp -d) +echo $tmp >&3 +trap "rm -rf $tmp" 0 +cd $tmp + +print2 setting up... +( cd $od; t/reset ) +echo "push @{ \$RC{ENABLE} }, 'refex-expr';" >> ~/.gitolite.rc +cat <<EOF >> ~/.gitolite/conf/gitolite.conf + + repo r2 + RW+ = @all + + RW+ VREF/NAME/doc/ = u2 + RW+ VREF/NAME/src/ = u2 + - VREF/NAME/doc/ and VREF/NAME/src/ = u2 + +EOF +gitolite setup +say2 done + +# ---------------------------------------------------------------------- + +git clone u2:r2 +cd r2 + +tsh 'tc aa' +git push origin master +say2 aa pass + +mkdir doc src + +tsh 'tc doc/d1' +git push origin master +say2 doc pass + +tsh 'tc src/s1' +tsh 'tc src/s2' +git push origin master +say2 src src pass + +tsh 'tc doc/d2 src/s3' +git push origin master && die 1 +git push u1:r2 master +say2 doc src u2 fail u1 pass diff --git a/t/refex-expr-test-3 b/t/refex-expr-test-3 new file mode 100755 index 0000000..47599eb --- /dev/null +++ b/t/refex-expr-test-3 @@ -0,0 +1,55 @@ +#!/bin/bash + +# not part of the official test suite (yet); just some q&d testing + +# to be run from ~/gitolite as ./$0 + +set -e +exec 3>&2 +exec > /dev/null +exec 2> /dev/null +print2() { echo -n "$@" >&3; } +say2() { echo "$@" >&3; } +die() { echo FATAL: "$@" >&3; exit 1; } + +export od=$PWD +export tmp=$(mktemp -d) +echo $tmp >&3 +trap "rm -rf $tmp" 0 +cd $tmp + +print2 setting up... +( cd $od; t/reset ) +echo "push @{ \$RC{ENABLE} }, 'refex-expr';" >> ~/.gitolite.rc +cat <<EOF >> ~/.gitolite/conf/gitolite.conf + + repo r3 + RW+ = u1 u2 u3 + + RW+ VREF/NAME/conf/ = u3 + - VREF/NAME/conf/ -gt 2 = u3 + +EOF +gitolite setup +say2 done + +# ---------------------------------------------------------------------- + +git clone u3:r3 +cd r3 + +tsh 'tc aa' +git push origin master +say2 aa pass + +mkdir doc conf + +tsh 'tc doc/d1 doc/d2 doc/d3 doc/d4 conf/c1' +git push origin master +say2 4 doc 1 conf pass + +tsh 'tc conf/c2 conf/c3 conf/c4' +git push origin master && die 1 + +git push u2:r3 master +say2 3 conf u3 fail u2 pass diff --git a/t/refex-expr-test-9 b/t/refex-expr-test-9 new file mode 100755 index 0000000..b3a9f09 --- /dev/null +++ b/t/refex-expr-test-9 @@ -0,0 +1,107 @@ +#!/bin/bash + +# not part of the official test suite (yet); just some q&d testing + +# to be run from ~/gitolite as ./$0 + +set -e +exec 3>&2 +exec > /dev/null +exec 2> /dev/null +print2() { echo -n "$@" >&3; } +say2() { echo "$@" >&3; } +die() { echo FATAL: "$@" >&3; exit 1; } + +export od=$PWD +export tmp=$(mktemp -d) +echo $tmp >&3 +trap "rm -rf $tmp" 0 +cd $tmp + +print2 setting up... +( cd $od; t/reset ) +echo "push @{ \$RC{ENABLE} }, 'refex-expr';" >> ~/.gitolite.rc +cat <<EOF >> ~/.gitolite/conf/gitolite.conf + +repo r9 + + RW+ = u3 u4 + + # u1 and u2 have some restrictions + + # cant push master + - master = u1 u2 + # cant push versioned tags, but other tags are fine + - refs/tags/v[0-9] = u1 u2 + # everything else is fine, but we need to recognise when they're pushing + # tags, so that the refex expr will have the correct info + RW+ refs/tags/ = u1 u2 + RW+ = u1 u2 + + # can push files in "foo/" only to a tag + RW+ VREF/NAME/foo/ = u1 u2 + + RW+ VREF/NAME/foo/ and refs/tags/ = u1 u2 + - VREF/NAME/foo/ and not refs/tags/ = u1 u2 + +EOF +gitolite setup +say2 done + +# ---------------------------------------------------------------------- + +# make sure u3 is not constrained in any way + +git clone u3:r9 refex-test.repo +cd refex-test.repo + +tsh 'tc u3-f1' +git pom + +mkdir bar foo +tsh 'tc bar/thr' +git pom +git tag v3 +git push origin v3 +tsh 'tc foo/rht' +git pom +git tag 3v +git push origin 3v + +say2 u3 no limits + +# now test u1's constraints + +cd .. +rm -rf refex-test.repo + +rm -rf ~/repositories/r9.git +gitolite setup + +git clone u1:r9 refex-test.repo +cd refex-test.repo + +tsh 'tc u1-f1' +# cant push master +git pom && die 1 +# can push other branches +git push origin master:m1 +say2 master fail m1 pass + +mkdir bar foo +tsh 'tc bar/one' +git push origin master:m1 +git tag v1 +# cant push v-tag +git push origin v1 && die 2 +say2 v-tag fail + +# cant push foo/ to a branch +tsh 'tc foo/eno' +git push origin master:m1 && die 3 +say2 foo/ m1 fail + +# but can push to a non-v-tag +git tag 1v +git push origin 1v +say2 foo/ non-v-tag pass |