2012-04-22 06:04:06 +02:00
|
|
|
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
# this is hardcoded; change it if needed
|
|
|
|
use lib "src/lib";
|
|
|
|
use Gitolite::Test;
|
|
|
|
|
|
|
|
# fork command
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
try "plan 30";
|
|
|
|
|
|
|
|
my $rb = `gitolite query-rc -n GL_REPO_BASE`;
|
|
|
|
|
|
|
|
confreset;confadd '
|
|
|
|
|
|
|
|
repo foo/CREATOR/..*
|
|
|
|
C = u1 u2
|
|
|
|
RW+ = CREATOR
|
|
|
|
';
|
|
|
|
|
|
|
|
try "ADMIN_PUSH set1; !/FATAL/" or die text();
|
|
|
|
|
|
|
|
try "
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# make the initial repo
|
|
|
|
glt ls-remote u1 file:///foo/u1/u1a;ok; gsh
|
|
|
|
/Initialized empty Git repository in .*/foo/u1/u1a.git/
|
|
|
|
# vrc doesn't have the fork command
|
2012-05-21 11:52:19 +02:00
|
|
|
glt fork u1 foo/u1/u1a foo/u1/u1a2; !ok; /FATAL: unknown git/gitolite command: \\'fork/
|
2012-04-22 06:04:06 +02:00
|
|
|
";
|
|
|
|
|
|
|
|
# allow fork as a valid command
|
|
|
|
$ENV{G3T_RC} = "$ENV{HOME}/g3trc";
|
|
|
|
put "$ENV{G3T_RC}", "\$rc{COMMANDS}{fork} = 1;\n\$rc{DEFAULT_ROLE_PERMS} = 'READERS \@all';\n";
|
|
|
|
|
|
|
|
try "
|
|
|
|
# now the fork succeeds
|
|
|
|
glt fork u1 foo/u1/u1a foo/u1/u1a2; ok; /Cloning into bare repository '.*/foo/u1/u1a2.git'/
|
|
|
|
/foo/u1/u1a forked to foo/u1/u1a2/
|
|
|
|
|
|
|
|
# now the actual testing starts
|
|
|
|
# read error
|
|
|
|
glt fork u1 foo/u1/u1c foo/u1/u1d; !ok; /'foo/u1/u1c' does not exist or you are not allowed to read it/
|
|
|
|
glt fork u2 foo/u1/u1a foo/u1/u1d; !ok; /'foo/u1/u1a' does not exist or you are not allowed to read it/
|
|
|
|
|
|
|
|
# write error
|
|
|
|
glt fork u1 foo/u1/u1a foo/u2/u1d; !ok; /'foo/u2/u1d' already exists or you are not allowed to create it/
|
|
|
|
|
|
|
|
# no error
|
|
|
|
glt fork u1 foo/u1/u1a foo/u1/u1e; ok; /Cloning into bare repository '.*/foo/u1/u1e.git'/
|
|
|
|
/warning: You appear to have cloned an empty repository/
|
|
|
|
/foo/u1/u1a forked to foo/u1/u1e/
|
|
|
|
# both exist
|
|
|
|
glt fork u1 foo/u1/u1a foo/u1/u1e; !ok; /'foo/u1/u1e' already exists or you are not allowed to create it/
|
|
|
|
";
|
|
|
|
|
|
|
|
# now check the various files that should have been produced
|
|
|
|
|
2012-04-28 08:33:32 +02:00
|
|
|
my $t;
|
|
|
|
try "cd $rb; find . -name gl-perms"; $t = md5sum(sort (lines())); cmp $t,
|
2012-11-06 01:49:13 +01:00
|
|
|
'd41d8cd98f00b204e9800998ecf8427e ./foo/u1/u1a.git/gl-perms
|
|
|
|
59b3a74b4d33c7631f08e75e7b60c7ce ./foo/u1/u1a2.git/gl-perms
|
2012-04-22 06:04:06 +02:00
|
|
|
59b3a74b4d33c7631f08e75e7b60c7ce ./foo/u1/u1e.git/gl-perms
|
|
|
|
';
|
|
|
|
|
2012-04-28 08:33:32 +02:00
|
|
|
try "cd $rb; find . -name gl-creator"; $t = md5sum(sort (lines())); cmp $t,
|
|
|
|
'e4774cdda0793f86414e8b9140bb6db4 ./foo/u1/u1a.git/gl-creator
|
|
|
|
346955ff2eadbf76e19373f07dd370a9 ./foo/u1/u1a2.git/gl-creator
|
2012-04-22 06:04:06 +02:00
|
|
|
346955ff2eadbf76e19373f07dd370a9 ./foo/u1/u1e.git/gl-creator
|
|
|
|
';
|