diff --git a/src/gitolite.pm b/src/gitolite.pm index 011fb6f..a806aa5 100644 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@ -400,7 +400,7 @@ sub get_set_perms # convert R and RW to the actual category names in the config file $perms =~ s/^\s*R /READERS /mg; $perms =~ s/^\s*RW /WRITERS /mg; - for my $g ($perms =~ /^\s*(\S+)/g) { + for my $g ($perms =~ /^\s*(\S+)/gm) { die "invalid permission category $g\n" unless $GL_WILDREPOS_PERM_CATS =~ /(^|\s)$g(\s|$)/; } print "New perms are:\n"; diff --git a/t/t63-perm-cats b/t/t63-perm-cats index 3565bfa..a928b50 100644 --- a/t/t63-perm-cats +++ b/t/t63-perm-cats @@ -1,5 +1,6 @@ -# vim: syn=sh: +# vim: ft=sh: # test gl-perms categories +tsh pwd || die '## tsh not installed?' for bc in 0 1 do @@ -111,15 +112,20 @@ do expect "W access for foo/u1/u1r1 DENIED to u2" name "add invalid category MANAGERS" - echo MANAGERS u2 | runlocal ssh u1 setperms foo/u1/u1r1 - expect "invalid permission category MANAGERS" + tsh " + ( echo READERS u6\; echo MANAGERS u2 ) | ssh u1 setperms foo/u1/u1r1; + !ok; /invalid permission category MANAGERS/ + " name "add u2 to now valid MANAGERS" echo "\$GL_WILDREPOS_PERM_CATS = 'READERS WRITERS MANAGERS';" | addrc - echo MANAGERS u2 | runlocal ssh u1 setperms foo/u1/u1r1 - notexpect "invalid permission category MANAGERS" - expect "New perms are:" - expect "MANAGERS u2" + tsh " + ( echo READERS u6\; echo MANAGERS u2 ) | ssh u1 setperms foo/u1/u1r1; + ok; !/invalid permission category MANAGERS/ + /New perms are:/ + /READERS u6/ + /MANAGERS u2/ + " runlocal git fetch runlocal git reset --hard origin/master diff --git a/t/test-driver.sh b/t/test-driver.sh index 5accdff..926ba2f 100755 --- a/t/test-driver.sh +++ b/t/test-driver.sh @@ -162,4 +162,4 @@ do done # this keeps changing as we add tests -echo 1..3157 +echo 1..3163