forked from sitaramc/gitolite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
390 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# vim: syn=perl: | ||
|
||
# "sugar script" (syntactic sugar helper) for gitolite3 | ||
# ---------------------------------------------------------------------- | ||
# see src/VREF/refex-expr for instructions and WARNINGS! | ||
|
||
my $perm = qr(-|R|RW\+?C?D?M?); | ||
|
||
my $seq = 1; | ||
sub sugar_script { | ||
my $lines = shift; | ||
|
||
Gitolite::Common::dd ['lines', $lines]; | ||
|
||
# my @out = (); | ||
for my $l (@$lines) { | ||
push @out, $l; | ||
|
||
# quick check | ||
next unless $l =~ /^($perm) /; | ||
# more detailed check | ||
next unless $l =~ /^($perm) (\S.*) = (\S.*)$/; | ||
my ($perm, $refexes, $users) = ($1, $2, $3); | ||
next unless $refexes =~ / (and|not|or|xor|\+|-|==|-lt|-gt|-eq|-le|-ge|-ne) /; | ||
|
||
print STDERR ">>>> $l\n"; | ||
pop @out; # we need to replace that last line | ||
|
||
my @words = grep { $_ !~ /^(and|not|or|xor|\+|-|==|-lt|-gt|-eq|-le|-ge|-ne)$/ } split ' ', $refexes; | ||
push @out, map { "RW+ $_ = $users" } @words; | ||
push @out, "option refex-expr.sugar$seq = $refexes"; | ||
push @out, "$perm VREF/refex-expr/sugar$seq = $users"; | ||
|
||
$seq++; | ||
} | ||
|
||
Gitolite::Common::dd ['out', \@out]; | ||
return \@out; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.