gitolite/t/t52-deny-create-ref

128 lines
3.4 KiB
Plaintext
Raw Normal View History

# vim: syn=sh:
for bc in 0 1
do
cd $TESTDIR
$TESTDIR/rollback || die "rollback failed"
editrc GL_BIG_CONFIG $bc
# ----------
# test "C" permissions
name "INTERNAL"
echo "
@leads = u1 u2
@devs = u1 u2 u3 u4
repo foo
RW+C = @leads
RW+C personal/USER/ = @devs
RW = @devs
" | ugc
cd ~/td
runlocal git clone u1:foo
cd foo
mdc; mdc; mdc; mdc; mdc
name "u1 can push/rewind master on foo"
runlocal git push origin master
expect_push_ok "master -> master"
runlocal git push -f origin master^^:master
expect_push_ok "master^^ -> master"
name "u2 can create newbr1 on foo"
runlocal git push u2:foo master:newbr1
expect_push_ok "master -> newbr1"
name "u2 can create newtag on foo"
runlocal git tag newtag
runlocal git push u2:foo newtag
expect_push_ok "newtag -> newtag"
name "u3 can push newbr1 on foo"
mdc; mdc; mdc; mdc; mdc
runlocal git push u3:foo master:newbr1
expect_push_ok "master -> newbr1"
name "u4 canNOT create newbr2 on foo"
mdc; mdc; mdc; mdc; mdc
runlocal git push u3:foo master:newbr2
expect "remote: C refs/heads/newbr2 foo u3 DENIED by fallthru"
expect "hook declined"
expect "failed to push"
name "u4 canNOT create newtag2 on foo"
runlocal git tag newtag2
runlocal git push u3:foo newtag2
expect "remote: C refs/tags/newtag2 foo u3 DENIED by fallthru"
expect "hook declined"
expect "failed to push"
name "u4 can create/rewind personal/u4/newbr3 on foo"
mdc; mdc; mdc; mdc; mdc
runlocal git push u4:foo master:personal/u4/newbr3
expect_push_ok "master -> personal/u4/newbr3"
runlocal git push -f origin master^^:personal/u4/newbr3
expect_push_ok "master^^ -> personal/u4/newbr3"
# bar, without "C" permissions, should behave like old
name "INTERNAL"
echo "
@leads = u1 u2
@devs = u1 u2 u3 u4
repo bar
RW+ = @leads
RW+ personal/USER/ = @devs
RW = @devs
" | ugc
cd ~/td
runlocal git clone u1:bar
cd bar
mdc; mdc; mdc; mdc; mdc
name "u1 can push/rewind master on bar"
runlocal git push origin master
expect_push_ok "master -> master"
runlocal git push -f origin master^^:master
expect_push_ok "master^^ -> master"
name "u2 can create newbr1 on bar"
runlocal git push u2:bar master:newbr1
expect_push_ok "master -> newbr1"
name "u2 can create newtag on bar"
runlocal git tag newtag
runlocal git push u2:bar newtag
expect_push_ok "newtag -> newtag"
name "u3 can push newbr1 on bar"
mdc; mdc; mdc; mdc; mdc
runlocal git push u3:bar master:newbr1
expect_push_ok "master -> newbr1"
name "u4 can create newbr2 on bar"
mdc; mdc; mdc; mdc; mdc
runlocal git push u3:bar master:newbr2
expect_push_ok "master -> newbr2"
name "u4 can create newtag2 on bar"
runlocal git tag newtag2
runlocal git push u3:bar newtag2
expect_push_ok "newtag2 -> newtag2"
name "u4 can create/rewind personal/u4/newbr3 on bar"
mdc; mdc; mdc; mdc; mdc
runlocal git push u4:bar master:personal/u4/newbr3
expect_push_ok "master -> personal/u4/newbr3"
runlocal git push -f origin master^^:personal/u4/newbr3
expect_push_ok "master^^ -> personal/u4/newbr3"
name INTERNAL
done