make REPO_BASE absolute early

$ENV{GL_REPO_BASE_ABS} is meant to point to the same directory as
$REPO_BASE, except it is meant to be passed to hooks, ADCs and other
child programs.  And since you can't be sure where the child program
starts in, this became an absolute path.

Gradually, however, I started using it wherever I needed an absolute
path (mostly in code that jumps around various directories to do stuff).
Which is silly, because there's no reason $REPO_BASE cannot also be made
an absolute, even if the rc file has a relative path.

So that's what I did now: made $REPO_BASE absolute very early on, and
then systematically changed all uses of the longer form to the shorter
form when appropriate.  And so the only thing we now use the longer one
for is to pass to child programs.

(Implementation note: The actual change is not very big, but while I was
about it I decided to make the test suite able to test with an absolute
REPO_BASE also, which is why the commit seems so large.)

----

This all started with a complaint from Damien Regad.  He had an
extremely odd setup where his bashrc changed PWD to something other than
$HOME before anything else ran.  This caused those two variables to
beceom inconsistent, and he had a 1-line fix he wanted me to apply.

I generally don't like making special fixes for for non-standard setups,
and anyway all he had to do was set the full path to REPO_BASE in the rc
file to get around this.  Which is what I told him and he very politely
left it at that.

However, this did get me thinking, and I soon realised I was needlessly
conflating "relative versus absolute" with "able to be passed to child
programs".  Fixing that solved his problem also, as a side-effect.

So I guess this is all thanks to Damien!
This commit is contained in:
Sitaram Chamarty 2011-03-18 10:59:52 +05:30
parent 85fe9c1739
commit 6539009cb5
31 changed files with 158 additions and 151 deletions

View file

@ -171,7 +171,7 @@ sub list_phy_repos
{ {
my @phy_repos; my @phy_repos;
wrap_chdir("$ENV{GL_REPO_BASE_ABS}"); wrap_chdir($REPO_BASE);
for my $repo (`find . -type d -name "*.git" -prune`) { for my $repo (`find . -type d -name "*.git" -prune`) {
chomp ($repo); chomp ($repo);
$repo =~ s(\./(.*)\.git$)($1); $repo =~ s(\./(.*)\.git$)($1);
@ -250,7 +250,7 @@ sub new_repo
sub new_wild_repo { sub new_wild_repo {
my ($repo, $user) = @_; my ($repo, $user) = @_;
wrap_chdir("$ENV{GL_REPO_BASE_ABS}"); wrap_chdir($REPO_BASE);
new_repo($repo, "$GL_ADMINDIR/hooks/common", $user); new_repo($repo, "$GL_ADMINDIR/hooks/common", $user);
# note pwd is now the bare "repo.git"; new_repo does that... # note pwd is now the bare "repo.git"; new_repo does that...
wrap_print("gl-perms", "$GL_WILDREPOS_DEFPERMS\n") if $GL_WILDREPOS_DEFPERMS; wrap_print("gl-perms", "$GL_WILDREPOS_DEFPERMS\n") if $GL_WILDREPOS_DEFPERMS;
@ -294,8 +294,8 @@ sub new_wild_repo {
# creator # creator
my $c = ''; my $c = '';
if ( -f "$ENV{GL_REPO_BASE_ABS}/$repo.git/gl-creater") { if ( -f "$REPO_BASE/$repo.git/gl-creater") {
my $fh = wrap_open("<", "$ENV{GL_REPO_BASE_ABS}/$repo.git/gl-creater"); my $fh = wrap_open("<", "$REPO_BASE/$repo.git/gl-creater");
chomp($c = <$fh>); chomp($c = <$fh>);
} }
@ -308,8 +308,8 @@ sub new_wild_repo {
# "WRITERS=>foo" and "TESTERS=>@all" # "WRITERS=>foo" and "TESTERS=>@all"
my %perm_cats; my %perm_cats;
if ($user and -f "$ENV{GL_REPO_BASE_ABS}/$repo.git/gl-perms") { if ($user and -f "$REPO_BASE/$repo.git/gl-perms") {
my $fh = wrap_open("<", "$ENV{GL_REPO_BASE_ABS}/$repo.git/gl-perms"); my $fh = wrap_open("<", "$REPO_BASE/$repo.git/gl-perms");
my $perms = join ("", <$fh>); my $perms = join ("", <$fh>);
# discard comments # discard comments
$perms =~ s/#.*//g; $perms =~ s/#.*//g;
@ -353,7 +353,7 @@ sub get_set_perms
$GL_WILDREPOS_PERM_CATS ||= "READERS WRITERS"; $GL_WILDREPOS_PERM_CATS ||= "READERS WRITERS";
my ($creator, $dummy, $dummy2) = wild_repo_rights($repo, ""); my ($creator, $dummy, $dummy2) = wild_repo_rights($repo, "");
die "$repo doesnt exist or is not yours\n" unless $user eq $creator; die "$repo doesnt exist or is not yours\n" unless $user eq $creator;
wrap_chdir("$ENV{GL_REPO_BASE_ABS}"); wrap_chdir($REPO_BASE);
wrap_chdir("$repo.git"); wrap_chdir("$repo.git");
if ($verb eq 'getperms') { if ($verb eq 'getperms') {
return unless -f "gl-perms"; return unless -f "gl-perms";
@ -390,7 +390,7 @@ sub get_set_desc
my($repo, $verb, $user) = @_; my($repo, $verb, $user) = @_;
my ($creator, $dummy, $dummy2) = wild_repo_rights($repo, ""); my ($creator, $dummy, $dummy2) = wild_repo_rights($repo, "");
die "$repo doesnt exist or is not yours\n" unless $user eq $creator; die "$repo doesnt exist or is not yours\n" unless $user eq $creator;
wrap_chdir("$ENV{GL_REPO_BASE_ABS}"); wrap_chdir($REPO_BASE);
wrap_chdir("$repo.git"); wrap_chdir("$repo.git");
if ($verb eq 'getdesc') { if ($verb eq 'getdesc') {
print slurp("description") if -f "description"; print slurp("description") if -f "description";
@ -562,7 +562,7 @@ sub expand_wild
# display matching repos (from *all* the repos in the system) that $user # display matching repos (from *all* the repos in the system) that $user
# has at least "R" access to # has at least "R" access to
chdir("$ENV{GL_REPO_BASE_ABS}") or die "chdir $ENV{GL_REPO_BASE_ABS} failed: $!\n"; chdir($REPO_BASE) or die "chdir $REPO_BASE failed: $!\n";
my $count = 0; my $count = 0;
for my $actual_repo (`find . -type d -name "*.git" -prune|sort`) { for my $actual_repo (`find . -type d -name "*.git" -prune|sort`) {
chomp ($actual_repo); chomp ($actual_repo);
@ -665,7 +665,7 @@ sub add_repo_conf
{ {
my ($repo) = shift; my ($repo) = shift;
return unless $split_conf{$repo}; return unless $split_conf{$repo};
do "$ENV{GL_REPO_BASE_ABS}/$repo.git/gl-conf" or return; do "$REPO_BASE/$repo.git/gl-conf" or return;
$repos{$repo} = $one_repo{$repo}; $repos{$repo} = $one_repo{$repo};
$git_configs{$repo} = $one_git_config{$repo}; $git_configs{$repo} = $one_git_config{$repo};
} }
@ -694,6 +694,8 @@ sub add_repo_conf
# means we've been called from outside; see doc/admin-defined-commands.mkd # means we've been called from outside; see doc/admin-defined-commands.mkd
where_is_rc(); where_is_rc();
die "parse $ENV{GL_RC} failed: " . ($! or $@) unless do $ENV{GL_RC}; die "parse $ENV{GL_RC} failed: " . ($! or $@) unless do $ENV{GL_RC};
# fix up REPO_BASE
$REPO_BASE = "$ENV{HOME}/$REPO_BASE" unless $REPO_BASE =~ m(^/);
} }
my $perm = ' '; my $perm = ' ';
@ -701,7 +703,7 @@ sub add_repo_conf
# get basic info about the repo and fill %repos # get basic info about the repo and fill %repos
my $wild = ''; my $wild = '';
my $exists = -d "$ENV{GL_REPO_BASE_ABS}/$repo.git"; my $exists = -d "$REPO_BASE/$repo.git";
if ($exists) { if ($exists) {
# the list of permission categories within gl-perms that this user is a member # the list of permission categories within gl-perms that this user is a member
# of, or that specify @all as a member. See comments in # of, or that specify @all as a member. See comments in
@ -768,7 +770,7 @@ sub can_read {
# helper to manage "disabling" a repo or the whole site for "W" access # helper to manage "disabling" a repo or the whole site for "W" access
sub check_repo_write_enabled { sub check_repo_write_enabled {
my ($repo) = shift; my ($repo) = shift;
for my $d ("$ENV{HOME}/.gitolite.down", "$ENV{GL_REPO_BASE_ABS}/$repo.git/.gitolite.down") { for my $d ("$ENV{HOME}/.gitolite.down", "$REPO_BASE/$repo.git/.gitolite.down") {
next unless -f $d; next unless -f $d;
die $ABRT . slurp($d) if -s $d; die $ABRT . slurp($d) if -s $d;
die $ABRT . "writes are currently disabled\n"; die $ABRT . "writes are currently disabled\n";

View file

@ -65,6 +65,9 @@ for ("$ENV{HOME}/.gitolite.rc", "/etc/gitolite/gitolite.rc") {
die "no rc file found\n" unless $ENV{GL_RC}; die "no rc file found\n" unless $ENV{GL_RC};
do $ENV{GL_RC} or die "error parsing $ENV{GL_RC}\n"; do $ENV{GL_RC} or die "error parsing $ENV{GL_RC}\n";
# fix up REPO_BASE
$REPO_BASE = "$ENV{HOME}/$REPO_BASE" unless $REPO_BASE =~ m(^/);
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# per perl rules, this should be the last line in such a file: # per perl rules, this should be the last line in such a file:
1; 1;

View file

@ -142,7 +142,7 @@ $ENV{GL_REPO}=$repo;
# first level permissions check # first level permissions check
my ($perm, $creator, $wild); my ($perm, $creator, $wild);
if ( $GL_ALL_READ_ALL and $verb =~ $R_COMMANDS and -d "$ENV{GL_REPO_BASE_ABS}/$repo.git") { if ( $GL_ALL_READ_ALL and $verb =~ $R_COMMANDS and -d "$REPO_BASE/$repo.git") {
$perm = 'R'; $perm = 'R';
} else { } else {
($perm, $creator, $wild) = repo_rights($repo); ($perm, $creator, $wild) = repo_rights($repo);
@ -164,8 +164,8 @@ check_repo_write_enabled($repo) if $aa eq 'W';
# get confused, in case the code in the pre-git hook forgot. To make it # get confused, in case the code in the pre-git hook forgot. To make it
# simple for the script, send in $aa (which will be 'R' or 'W') so now they # simple for the script, send in $aa (which will be 'R' or 'W') so now they
# have all three: GL_USER and GL_REPO in the env, and $aa as arg-1. # have all three: GL_USER and GL_REPO in the env, and $aa as arg-1.
if (-x "$ENV{GL_REPO_BASE_ABS}/$repo.git/hooks/gl-pre-git") { if (-x "$REPO_BASE/$repo.git/hooks/gl-pre-git") {
system("cd $ENV{GL_REPO_BASE_ABS}/$repo.git; hooks/gl-pre-git $aa >&2"); system("cd $REPO_BASE/$repo.git; hooks/gl-pre-git $aa >&2");
die "gl-pre-git hook failed ($?)\n" if $?; die "gl-pre-git hook failed ($?)\n" if $?;
} }

View file

@ -383,10 +383,6 @@ die "\n\t\t***** AAARGH! *****\n" .
# doc/big-config.mkd for details. # doc/big-config.mkd for details.
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# repo-base needs to be an absolute path due to all the jumping around we do,
# so if it was not already absolute, prefix $HOME.
$ENV{GL_REPO_BASE_ABS} = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$ENV{HOME}/$REPO_BASE" );
# process the normal repos in %repos. This includes creating them if needed # process the normal repos in %repos. This includes creating them if needed
# (and GL_NO_CREATE_REPOS is not set), checking hooks, and finally, if # (and GL_NO_CREATE_REPOS is not set), checking hooks, and finally, if
# GL_BIG_CONFIG is set, writing out the one-repo config file for directly # GL_BIG_CONFIG is set, writing out the one-repo config file for directly
@ -400,7 +396,7 @@ write_compiled_conf(); # write out the final compiled config
sub do_normal_repos sub do_normal_repos
{ {
wrap_chdir("$ENV{GL_REPO_BASE_ABS}"); wrap_chdir($REPO_BASE);
# start with the ones that are normal repos in %repos # start with the ones that are normal repos in %repos
my @repos = grep { $_ =~ $REPONAME_PATT and not /^@/ } sort keys %repos; my @repos = grep { $_ =~ $REPONAME_PATT and not /^@/ } sort keys %repos;
@ -419,7 +415,7 @@ sub do_normal_repos
print STDERR "creating $repo...\n"; print STDERR "creating $repo...\n";
new_repo($repo, "$GL_ADMINDIR/hooks/common"); new_repo($repo, "$GL_ADMINDIR/hooks/common");
# new_repo would have chdir'd us away; come back # new_repo would have chdir'd us away; come back
wrap_chdir("$ENV{GL_REPO_BASE_ABS}"); wrap_chdir($REPO_BASE);
} }
# when repos are copied over from elsewhere, one had to run easy install # when repos are copied over from elsewhere, one had to run easy install
@ -520,13 +516,13 @@ my %projlist = ();
# sub parse_acl (look for variable $saved_crwu) # sub parse_acl (look for variable $saved_crwu)
for my $repo (@phy_repos) { for my $repo (@phy_repos) {
wrap_chdir("$ENV{GL_REPO_BASE_ABS}/$repo.git"); wrap_chdir("$REPO_BASE/$repo.git");
# daemon is easy # daemon is easy
setup_daemon_access($repo); setup_daemon_access($repo);
} }
for my $repo (@phy_repos) { for my $repo (@phy_repos) {
wrap_chdir("$ENV{GL_REPO_BASE_ABS}/$repo.git"); wrap_chdir("$REPO_BASE/$repo.git");
# gitweb is a little more complicated. Here're some notes: # gitweb is a little more complicated. Here're some notes:
# - "setup_gitweb_access" also sets "owner", despite the name # - "setup_gitweb_access" also sets "owner", despite the name
# - specifying a description also counts as enabling gitweb # - specifying a description also counts as enabling gitweb

View file

@ -53,9 +53,6 @@ unless ($ENV{GL_RC}) {
exit; exit;
} }
# ok now the rc file exists; read it to get the other paths
die "parse $ENV{GL_RC} failed: " . ($! or $@) unless do $ENV{GL_RC};
# add a custom path for git binaries, if specified # add a custom path for git binaries, if specified
$ENV{PATH} .= ":$GIT_PATH" if $GIT_PATH; $ENV{PATH} .= ":$GIT_PATH" if $GIT_PATH;
@ -63,8 +60,7 @@ $ENV{PATH} .= ":$GIT_PATH" if $GIT_PATH;
umask($REPO_UMASK); umask($REPO_UMASK);
# mkdir $REPO_BASE, $GL_ADMINDIR if they don't already exist # mkdir $REPO_BASE, $GL_ADMINDIR if they don't already exist
$ENV{GL_REPO_BASE_ABS} = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$ENV{HOME}/$REPO_BASE" ); wrap_mkdir($REPO_BASE);
wrap_mkdir($ENV{GL_REPO_BASE_ABS});
wrap_mkdir($GL_ADMINDIR, 0700); wrap_mkdir($GL_ADMINDIR, 0700);
# mkdir $GL_ADMINDIR's subdirs # mkdir $GL_ADMINDIR's subdirs
for my $dir qw(conf doc keydir logs src hooks hooks/common hooks/gitolite-admin) { for my $dir qw(conf doc keydir logs src hooks hooks/common hooks/gitolite-admin) {
@ -93,7 +89,7 @@ EOF
} }
# finally, hooks must be propagated to all the repos in case they changed # finally, hooks must be propagated to all the repos in case they changed
chdir("$ENV{GL_REPO_BASE_ABS}") or die "chdir $ENV{GL_REPO_BASE_ABS} failed: $!\n"; chdir($REPO_BASE) or die "chdir $REPO_BASE failed: $!\n";
for my $repo (`find . -type d -name "*.git" -prune`) { for my $repo (`find . -type d -name "*.git" -prune`) {
chomp ($repo); chomp ($repo);
# propagate our own, plus any local admin-defined, hooks # propagate our own, plus any local admin-defined, hooks

View file

@ -16,7 +16,7 @@ chmod 600 ~/.ssh/u?
# blank out the server side # blank out the server side
echo the next command MAY ask for a password echo the next command MAY ask for a password
ssh gitolite-test@localhost rm -rf .ssh .gitolite .gitolite.rc repositories gitolite-install ssh gitolite-test@localhost rm -rf .ssh .gitolite .gitolite.rc repositories gitolite-install /tmp/glrb
echo the next command SHOULD ask for a password echo the next command SHOULD ask for a password
ssh-copy-id -i ~/.ssh/id_rsa gitolite-test@localhost ssh-copy-id -i ~/.ssh/id_rsa gitolite-test@localhost
echo the next command should NOT ask for a password echo the next command should NOT ask for a password
@ -33,4 +33,6 @@ git push
# make the rollback.tar files on both sides # make the rollback.tar files on both sides
cd cd
tar cf rollback.tar gitolite-admin tar cf rollback.tar gitolite-admin
ssh gitolite-test@localhost mkdir -p repositories /tmp/glrb
ssh gitolite-test@localhost tar cf rollback.tar .ssh .gitolite .gitolite.rc repositories gitolite-install ssh gitolite-test@localhost tar cf rollback.tar .ssh .gitolite .gitolite.rc repositories gitolite-install
ssh gitolite-test@localhost tar -C /tmp -cf \$HOME/rollback2.tar glrb

View file

@ -6,10 +6,10 @@ $data_version = '1.7';
'gitolite-admin' => 1, 'gitolite-admin' => 1,
'testing' => 1 'testing' => 1
); );
repositories/aa.git/gl-conf ./aa.git/gl-conf
repositories/bb.git/gl-conf ./bb.git/gl-conf
repositories/gitolite-admin.git/gl-conf ./gitolite-admin.git/gl-conf
repositories/testing.git/gl-conf ./testing.git/gl-conf
%one_repo = ( %one_repo = (
'aa' => { 'aa' => {
'R' => { 'R' => {

View file

@ -35,8 +35,8 @@ $data_version = '1.7';
'gitolite-admin' => 1, 'gitolite-admin' => 1,
'testing' => 1 'testing' => 1
); );
repositories/gitolite-admin.git/gl-conf ./gitolite-admin.git/gl-conf
repositories/testing.git/gl-conf ./testing.git/gl-conf
%one_repo = ( %one_repo = (
'gitolite-admin' => { 'gitolite-admin' => {
'R' => { 'R' => {

View file

@ -5,9 +5,9 @@ $data_version = '1.7';
'gitolite-admin' => 1, 'gitolite-admin' => 1,
'testing' => 1 'testing' => 1
); );
repositories/aa.git/gl-conf ./aa.git/gl-conf
repositories/gitolite-admin.git/gl-conf ./gitolite-admin.git/gl-conf
repositories/testing.git/gl-conf ./testing.git/gl-conf
%one_repo = ( %one_repo = (
'aa' => { 'aa' => {
'R' => { 'R' => {

View file

@ -19,9 +19,9 @@ $data_version = '1.7';
'gitolite-admin' => 1, 'gitolite-admin' => 1,
'testing' => 1 'testing' => 1
); );
repositories/aa.git/gl-conf ./aa.git/gl-conf
repositories/gitolite-admin.git/gl-conf ./gitolite-admin.git/gl-conf
repositories/testing.git/gl-conf ./testing.git/gl-conf
%one_repo = ( %one_repo = (
'aa' => { 'aa' => {
'@g1' => [ '@g1' => [

View file

@ -1,8 +1,9 @@
#!/bin/bash #!/bin/bash
cd cd
rm -rf .ssh .gitolite .gitolite.rc repositories gitolite-install rm -rf .ssh .gitolite .gitolite.rc repositories gitolite-install /tmp/glrb
tar xf rollback.tar tar xf rollback.tar
( cd /tmp; tar xf ~/rollback2.tar )
# if arg1 is a directory, we have to overwrite sources from there (see commit # if arg1 is a directory, we have to overwrite sources from there (see commit
# message for details) # message for details)

View file

@ -13,7 +13,7 @@ expect "To gitolite:gitolite-admin"
expect "master -> master" expect "master -> master"
name "basic create repo" name "basic create repo"
expect "remote: Initialized empty Git repository in /home/gitolite-test/repositories/aa.git/" expect "remote: Initialized empty Git repository in $TEST_BASE_FULL/aa.git/"
# ---------- # ----------
name "basic clone" name "basic clone"

View file

@ -22,12 +22,12 @@ cd ~/td
name "u1 create success" name "u1 create success"
runlocal git clone u1:foo/u1/a01 runlocal git clone u1:foo/u1/a01
expect "Initialized empty Git repository in /home/gitolite-test/repositories/foo/u1/a01.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/foo/u1/a01.git/"
# expect "R access for foo/u1/a01 DENIED to u1" # expect "R access for foo/u1/a01 DENIED to u1"
name "u2 create success" name "u2 create success"
runlocal git clone u2:foo/u2/a02 runlocal git clone u2:foo/u2/a02
expect "Initialized empty Git repository in /home/gitolite-test/repositories/foo/u2/a02.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/foo/u2/a02.git/"
# expect "R access for foo/u2/a02 DENIED to u2" # expect "R access for foo/u2/a02 DENIED to u2"
name "u4 tries to create u2 repo" name "u4 tries to create u2 repo"
@ -40,7 +40,7 @@ expect "R access for foo/u4/a1234 DENIED to u4"
name "u4 tries to create his own repo" name "u4 tries to create his own repo"
runlocal git clone u4:foo/u4/a12 runlocal git clone u4:foo/u4/a12
expect "Initialized empty Git repository in /home/gitolite-test/repositories/foo/u4/a12.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/foo/u4/a12.git/"
expect "warning: You appear to have cloned an empty repository." expect "warning: You appear to have cloned an empty repository."
name "u4 push success" name "u4 push success"

View file

@ -38,7 +38,7 @@ expect "R access for foo/u4/a1234 DENIED to u4"
name "u4 tries to create his own repo" name "u4 tries to create his own repo"
runlocal git clone u4:foo/u4/a12 runlocal git clone u4:foo/u4/a12
expect "Initialized empty Git repository in /home/gitolite-test/repositories/foo/u4/a12.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/foo/u4/a12.git/"
expect "warning: You appear to have cloned an empty repository." expect "warning: You appear to have cloned an empty repository."
name "u4 push success" name "u4 push success"

View file

@ -30,7 +30,7 @@ echo "
" > conf/fragments/u1r.conf " > conf/fragments/u1r.conf
ugc < /dev/null ugc < /dev/null
expect "create mode 100644 conf/fragments/u1r.conf" expect "create mode 100644 conf/fragments/u1r.conf"
expect "remote: Initialized empty Git repository in /home/gitolite-test/repositories/r1a.git/" expect "remote: Initialized empty Git repository in $TEST_BASE_FULL/r1a.git/"
expect "To gitolite:gitolite-admin" expect "To gitolite:gitolite-admin"
expect "master -> master" expect "master -> master"

View file

@ -21,7 +21,7 @@ do
cd ~/td cd ~/td
runlocal git clone u1:foo/u1/bar runlocal git clone u1:foo/u1/bar
expect "Initialized empty Git repository in /home/gitolite-test/repositories/foo/u1/bar.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/foo/u1/bar.git/"
cd bar cd bar
mdc u1file1 mdc u1file1

View file

@ -26,7 +26,7 @@ do
runlocal git clone u1:foo/u1/bar runlocal git clone u1:foo/u1/bar
[ "$wr" = "0" ] && expect "R access for foo/u1/bar DENIED to u1" [ "$wr" = "0" ] && expect "R access for foo/u1/bar DENIED to u1"
[ "$wr" = "0" ] && expect "fatal: The remote end hung up unexpectedly" [ "$wr" = "0" ] && expect "fatal: The remote end hung up unexpectedly"
[ "$wr" = "1" ] && expect "Initialized empty Git repository in /home/gitolite-test/repositories/foo/u1/bar.git/" [ "$wr" = "1" ] && expect "Initialized empty Git repository in $TEST_BASE_FULL/foo/u1/bar.git/"
name "u3 fails to make a wildrepo" name "u3 fails to make a wildrepo"
runlocal git clone u3:foo/u3/baz runlocal git clone u3:foo/u3/baz

View file

@ -45,10 +45,10 @@ do
RW = @devs RW = @devs
config foo.bar = baz config foo.bar = baz
" | ugc -r " | ugc -r
expect "remote: Initialized empty Git repository in /home/gitolite-test/repositories/bar.git/" expect "remote: Initialized empty Git repository in $TEST_BASE_FULL/bar.git/"
notexpect "git config.*not allowed" notexpect "git config.*not allowed"
expect_push_ok "master -> master" expect_push_ok "master -> master"
runremote cat repositories/bar.git/config runremote cat $TEST_BASE/bar.git/config
expect '^.foo' expect '^.foo'
expect 'bar = baz' expect 'bar = baz'
@ -65,7 +65,7 @@ do
config foobar.baz = ooka config foobar.baz = ooka
" | ugc -r " | ugc -r
expect "remote: git config foobar.baz not allowed" expect "remote: git config foobar.baz not allowed"
runremote cat repositories/bar.git/config runremote cat $TEST_BASE/bar.git/config
expect '^.foo' expect '^.foo'
expect 'bar = baz' expect 'bar = baz'
notexpect '^.foobar' notexpect '^.foobar'
@ -82,7 +82,7 @@ do
RW = @devs RW = @devs
config foo.bar = config foo.bar =
" | ugc -r " | ugc -r
runremote cat repositories/bar.git/config runremote cat $TEST_BASE/bar.git/config
expect '^.foo' expect '^.foo'
notexpect 'bar = baz' notexpect 'bar = baz'

View file

@ -71,10 +71,10 @@ do
name "u1 create bar/try1" name "u1 create bar/try1"
runlocal git ls-remote u1:bar/try1 runlocal git ls-remote u1:bar/try1
expect "Initialized empty Git repository in /home/gitolite-test/repositories/bar/try1.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/bar/try1.git/"
name "check u1 has foo.bar" name "check u1 has foo.bar"
runremote cat repositories/bar/try1.git/config runremote cat $TEST_BASE/bar/try1.git/config
expect '^.foo' expect '^.foo'
expect 'bar = baz' expect 'bar = baz'
@ -93,16 +93,16 @@ do
expect_push_ok "master -> master" expect_push_ok "master -> master"
name "check u1 doesnt have foo.bar" name "check u1 doesnt have foo.bar"
runremote cat repositories/bar/try1.git/config runremote cat $TEST_BASE/bar/try1.git/config
expect '^.foo' # git leaves the section header behind expect '^.foo' # git leaves the section header behind
notexpect 'bar = baz' notexpect 'bar = baz'
name "u2 create bar/try2" name "u2 create bar/try2"
runlocal git ls-remote u2:bar/try2 runlocal git ls-remote u2:bar/try2
expect "Initialized empty Git repository in /home/gitolite-test/repositories/bar/try2.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/bar/try2.git/"
name "check u2 doesnt have foo.bar" name "check u2 doesnt have foo.bar"
runremote cat repositories/bar/try2.git/config runremote cat $TEST_BASE/bar/try2.git/config
notexpect '^.foo' # but not here, since this repo never had the key at all notexpect '^.foo' # but not here, since this repo never had the key at all
notexpect 'bar = baz' notexpect 'bar = baz'
@ -121,12 +121,12 @@ do
expect_push_ok "master -> master" expect_push_ok "master -> master"
name "check u1 has foo.frob" name "check u1 has foo.frob"
runremote cat repositories/bar/try1.git/config runremote cat $TEST_BASE/bar/try1.git/config
expect '^.foo' expect '^.foo'
expect 'frob = nitz' expect 'frob = nitz'
name "check u2 has foo.frob" name "check u2 has foo.frob"
runremote cat repositories/bar/try2.git/config runremote cat $TEST_BASE/bar/try2.git/config
expect '^.foo' expect '^.foo'
expect 'frob = nitz' expect 'frob = nitz'

View file

@ -65,10 +65,10 @@ do
name "u1 create bar/u1/try1" name "u1 create bar/u1/try1"
runlocal git ls-remote u1:bar/u1/try1 runlocal git ls-remote u1:bar/u1/try1
expect "Initialized empty Git repository in /home/gitolite-test/repositories/bar/u1/try1.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/bar/u1/try1.git/"
name "check u1 has foo.bar" name "check u1 has foo.bar"
runremote cat repositories/bar/u1/try1.git/config runremote cat $TEST_BASE/bar/u1/try1.git/config
expect '^.foo' expect '^.foo'
expect 'bar = baz' expect 'bar = baz'
@ -86,16 +86,16 @@ do
expect_push_ok "master -> master" expect_push_ok "master -> master"
name "check u1 doesnt have foo.bar" name "check u1 doesnt have foo.bar"
runremote cat repositories/bar/u1/try1.git/config runremote cat $TEST_BASE/bar/u1/try1.git/config
expect '^.foo' # git leaves the section header behind expect '^.foo' # git leaves the section header behind
notexpect 'bar = baz' notexpect 'bar = baz'
name "u2 create bar/u2/try2" name "u2 create bar/u2/try2"
runlocal git ls-remote u2:bar/u2/try2 runlocal git ls-remote u2:bar/u2/try2
expect "Initialized empty Git repository in /home/gitolite-test/repositories/bar/u2/try2.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/bar/u2/try2.git/"
name "check u2 doesnt have foo.bar" name "check u2 doesnt have foo.bar"
runremote cat repositories/bar/u2/try2.git/config runremote cat $TEST_BASE/bar/u2/try2.git/config
notexpect '^.foo' # but not here, since this repo never had the key at all notexpect '^.foo' # but not here, since this repo never had the key at all
notexpect 'bar = baz' notexpect 'bar = baz'
@ -113,12 +113,12 @@ do
expect_push_ok "master -> master" expect_push_ok "master -> master"
name "check u1 has foo.frob" name "check u1 has foo.frob"
runremote cat repositories/bar/u1/try1.git/config runremote cat $TEST_BASE/bar/u1/try1.git/config
expect '^.foo' expect '^.foo'
expect 'frob = nitz' expect 'frob = nitz'
name "check u2 has foo.frob" name "check u2 has foo.frob"
runremote cat repositories/bar/u2/try2.git/config runremote cat $TEST_BASE/bar/u2/try2.git/config
expect '^.foo' expect '^.foo'
expect 'frob = nitz' expect 'frob = nitz'

View file

@ -15,9 +15,9 @@ do
name "INTERNAL" name "INTERNAL"
echo|ugc echo|ugc
name "daemon access for testing repo" name "daemon access for testing repo"
runremote ls -al repositories/testing.git/git-daemon-export-ok runremote ls -al $TEST_BASE/testing.git/git-daemon-export-ok
[ "$ais" = "0" ] && expect "ls: cannot access repositories/testing.git/git-daemon-export-ok: No such file or directory" [ "$ais" = "0" ] && expect "ls: cannot access $TEST_BASE/testing.git/git-daemon-export-ok: No such file or directory"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test .* repositories/testing.git/git-daemon-export-ok" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test .* $TEST_BASE/testing.git/git-daemon-export-ok"
name "INTERNAL" name "INTERNAL"
echo " echo "
@ -30,8 +30,8 @@ do
RW = @devs RW = @devs
" | ugc " | ugc
expect_push_ok "master -> master" expect_push_ok "master -> master"
runremote ls -al repositories/bar.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar.git/git-daemon-export-ok
expect "ls: cannot access repositories/bar.git/git-daemon-export-ok: No such file or directory" expect "ls: cannot access $TEST_BASE/bar.git/git-daemon-export-ok: No such file or directory"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list"
@ -43,8 +43,8 @@ do
echo " echo "
R = daemon R = daemon
" | ugc " | ugc
runremote ls -al repositories/bar.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar.git/git-daemon-export-ok" expect "gitolite-test gitolite-test .* $TEST_BASE/bar.git/git-daemon-export-ok"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list"
@ -93,7 +93,7 @@ do
baz = \"this is repo baz\" baz = \"this is repo baz\"
" | ugc " | ugc
expect_push_ok "master -> master" expect_push_ok "master -> master"
expect "remote: Initialized empty Git repository in /home/gitolite-test/repositories/baz.git/" expect "remote: Initialized empty Git repository in $TEST_BASE_FULL/baz.git/"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 24 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 24 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 36 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 36 .* projects.list"
@ -103,9 +103,9 @@ do
expect "foo.git" expect "foo.git"
expect "bar.git" expect "bar.git"
expect "baz.git" expect "baz.git"
runremote ls -al repositories/baz.git/description runremote ls -al $TEST_BASE/baz.git/description
expect "gitolite-test gitolite-test 17 .* repositories/baz.git/description" expect "gitolite-test gitolite-test 17 .* $TEST_BASE/baz.git/description"
runremote cat repositories/baz.git/description runremote cat $TEST_BASE/baz.git/description
expect "this is repo baz" expect "this is repo baz"
name "add owner to testing repo" name "add owner to testing repo"
@ -120,12 +120,12 @@ do
expect "foo.git" expect "foo.git"
expect "bar.git" expect "bar.git"
expect "baz.git" expect "baz.git"
runremote cat repositories/testing.git/config runremote cat $TEST_BASE/testing.git/config
expect "\[gitweb\]" expect "\[gitweb\]"
expect "owner = sitaram" expect "owner = sitaram"
runremote ls -al repositories/testing.git/description runremote ls -al $TEST_BASE/testing.git/description
expect "gitolite-test gitolite-test 25 .* repositories/testing.git/description" expect "gitolite-test gitolite-test 25 .* $TEST_BASE/testing.git/description"
runremote cat repositories/testing.git/description runremote cat $TEST_BASE/testing.git/description
expect "this is the testing repo" expect "this is the testing repo"
name INTERNAL name INTERNAL

View file

@ -24,8 +24,8 @@ do
" | ugc " | ugc
expect_push_ok "master -> master" expect_push_ok "master -> master"
runlocal git ls-remote u1:bar/u1/try1 runlocal git ls-remote u1:bar/u1/try1
runremote ls -al repositories/bar/u1/try1.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok
expect "ls: cannot access repositories/bar/u1/try1.git/git-daemon-export-ok: No such file or directory" expect "ls: cannot access $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok: No such file or directory"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list"
@ -38,16 +38,16 @@ do
echo " echo "
R = daemon R = daemon
" | ugc " | ugc
runremote ls -al repositories/bar/u1/try1.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try1.git/git-daemon-export-ok" expect "gitolite-test gitolite-test .* $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list"
name "add one more repo" name "add one more repo"
runlocal git ls-remote u1:bar/u1/try2 runlocal git ls-remote u1:bar/u1/try2
runremote ls -al repositories/bar/u1/try2.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try2.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try2.git/git-daemon-export-ok" expect "gitolite-test gitolite-test .* $TEST_BASE/bar/u1/try2.git/git-daemon-export-ok"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list"
@ -71,13 +71,13 @@ do
expect "bar/u1/try1.git" expect "bar/u1/try1.git"
notexpect "bar/u1/try2.git" notexpect "bar/u1/try2.git"
notexpect "bar/u1/try3.git" notexpect "bar/u1/try3.git"
runremote cat repositories/bar/u1/try1.git/description runremote cat $TEST_BASE/bar/u1/try1.git/description
expect "this is bar/u1/try1" expect "this is bar/u1/try1"
name "add try3 project" name "add try3 project"
runlocal git ls-remote u1:bar/u1/try3 runlocal git ls-remote u1:bar/u1/try3
runremote ls -al repositories/bar/u1/try3.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try3.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try3.git/git-daemon-export-ok" expect "gitolite-test gitolite-test .* $TEST_BASE/bar/u1/try3.git/git-daemon-export-ok"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 16 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 16 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 28 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 28 .* projects.list"
@ -87,16 +87,16 @@ do
expect "bar/u1/try1.git" expect "bar/u1/try1.git"
notexpect "bar/u1/try2.git" notexpect "bar/u1/try2.git"
notexpect "bar/u1/try3.git" notexpect "bar/u1/try3.git"
runremote cat repositories/bar/u1/try1.git/description runremote cat $TEST_BASE/bar/u1/try1.git/description
expect "this is bar/u1/try1" expect "this is bar/u1/try1"
runremote cat repositories/bar/u1/try3.git/description runremote cat $TEST_BASE/bar/u1/try3.git/description
expect "Unnamed repository; edit this file 'description' to name the repository." expect "Unnamed repository; edit this file 'description' to name the repository."
name "now compile and recheck try3 stuff" name "now compile and recheck try3 stuff"
echo " echo "
" | ugc " | ugc
runremote ls -al repositories/bar/u1/try3.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try3.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try3.git/git-daemon-export-ok" expect "gitolite-test gitolite-test .* $TEST_BASE/bar/u1/try3.git/git-daemon-export-ok"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 32 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 32 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 44 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 44 .* projects.list"
@ -106,16 +106,16 @@ do
expect "bar/u1/try1.git" expect "bar/u1/try1.git"
notexpect "bar/u1/try2.git" notexpect "bar/u1/try2.git"
expect "bar/u1/try3.git" expect "bar/u1/try3.git"
runremote cat repositories/bar/u1/try1.git/description runremote cat $TEST_BASE/bar/u1/try1.git/description
expect "this is bar/u1/try1" expect "this is bar/u1/try1"
runremote cat repositories/bar/u1/try3.git/description runremote cat $TEST_BASE/bar/u1/try3.git/description
expect "this is bar/u1/try3" expect "this is bar/u1/try3"
name "add owner for try2 and compile" name "add owner for try2 and compile"
echo " echo "
bar/u1/try2 \"owner2\" = \"this is bar/u1/try1\" bar/u1/try2 \"owner2\" = \"this is bar/u1/try1\"
" | ugc " | ugc
runremote cat repositories/bar/u1/try2.git/config runremote cat $TEST_BASE/bar/u1/try2.git/config
expect "\[gitweb\]" expect "\[gitweb\]"
expect "owner = owner2" expect "owner = owner2"
runremote ls -al projects.list runremote ls -al projects.list
@ -152,7 +152,7 @@ do
expect "bar/u1/try2.git" expect "bar/u1/try2.git"
expect "bar/u1/try3.git" expect "bar/u1/try3.git"
expect "bar/u1/try4.git" expect "bar/u1/try4.git"
runremote cat repositories/bar/u1/try4.git/description runremote cat $TEST_BASE/bar/u1/try4.git/description
expect "Unnamed repository; edit this file 'description' to name the repository." expect "Unnamed repository; edit this file 'description' to name the repository."
name "INTERNAL" name "INTERNAL"

View file

@ -19,7 +19,7 @@ do
R = @g2 R = @g2
" | ugc " | ugc
expect_push_ok "master -> master" expect_push_ok "master -> master"
expect "remote: Initialized empty Git repository in /home/gitolite-test/repositories/aa.git/" expect "remote: Initialized empty Git repository in $TEST_BASE_FULL/aa.git/"
cd ~/td cd ~/td
name "check u1 can auto-create and push" name "check u1 can auto-create and push"
@ -71,24 +71,24 @@ do
expect "R access for aa DENIED to u6" expect "R access for aa DENIED to u6"
# now the same thing with the repo-on-disk missing # now the same thing with the repo-on-disk missing
runremote rm -rf repositories/aa.git runremote rm -rf $TEST_BASE/aa.git
cd ~/td cd ~/td
name "repo on disk missing: u1" name "repo on disk missing: u1"
runlocal git clone u1:aa runlocal git clone u1:aa
[ "$bc" = "0" ] && expect "fatal: 'repositories/aa.git' does not appear to be a git repository" [ "$bc" = "0" ] && expect "fatal: '$TEST_BASE_FULL/aa.git' does not appear to be a git repository"
[ "$bc" = "1" ] && expect "R access for aa DENIED to u1" [ "$bc" = "1" ] && expect "R access for aa DENIED to u1"
[ "$bc" = "1" ] && expect "Or there may be no repository at the given path. Did you spell it correctly?" [ "$bc" = "1" ] && expect "Or there may be no repository at the given path. Did you spell it correctly?"
name "repo on disk missing: tester" name "repo on disk missing: tester"
runlocal git clone gitolite:aa runlocal git clone gitolite:aa
[ "$bc" = "0" ] && expect "fatal: 'repositories/aa.git' does not appear to be a git repository" [ "$bc" = "0" ] && expect "fatal: '$TEST_BASE_FULL/aa.git' does not appear to be a git repository"
[ "$bc" = "1" ] && expect "R access for aa DENIED to tester" [ "$bc" = "1" ] && expect "R access for aa DENIED to tester"
[ "$bc" = "1" ] && expect "Or there may be no repository at the given path. Did you spell it correctly?" [ "$bc" = "1" ] && expect "Or there may be no repository at the given path. Did you spell it correctly?"
name "repo on disk missing: u4" name "repo on disk missing: u4"
runlocal git clone u4:aa runlocal git clone u4:aa
[ "$bc" = "0" ] && expect "fatal: 'repositories/aa.git' does not appear to be a git repository" [ "$bc" = "0" ] && expect "fatal: '$TEST_BASE_FULL/aa.git' does not appear to be a git repository"
[ "$bc" = "1" ] && expect "R access for aa DENIED to u4" [ "$bc" = "1" ] && expect "R access for aa DENIED to u4"
[ "$bc" = "1" ] && expect "Or there may be no repository at the given path. Did you spell it correctly?" [ "$bc" = "1" ] && expect "Or there may be no repository at the given path. Did you spell it correctly?"

View file

@ -25,8 +25,8 @@ do
expect_push_ok "master -> master" expect_push_ok "master -> master"
runlocal git ls-remote u1:bar/u1/try1 runlocal git ls-remote u1:bar/u1/try1
runremote ls -al repositories/bar/u1/try1.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok
expect "ls: cannot access repositories/bar/u1/try1.git/git-daemon-export-ok: No such file or directory" expect "ls: cannot access $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok: No such file or directory"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list"
@ -34,8 +34,8 @@ do
notexpect "bar/u1/try1.git" notexpect "bar/u1/try1.git"
runlocal git ls-remote u1:bar/u1/try2 runlocal git ls-remote u1:bar/u1/try2
runremote ls -al repositories/bar/u1/try2.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try2.git/git-daemon-export-ok
expect "ls: cannot access repositories/bar/u1/try2.git/git-daemon-export-ok: No such file or directory" expect "ls: cannot access $TEST_BASE/bar/u1/try2.git/git-daemon-export-ok: No such file or directory"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list"
@ -46,8 +46,8 @@ do
echo R daemon | runlocal ssh u1 setperms bar/u1/try1 echo R daemon | runlocal ssh u1 setperms bar/u1/try1
expect "READERS daemon" expect "READERS daemon"
runremote ls -al repositories/bar/u1/try1.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try1.git/git-daemon-export-ok" expect "gitolite-test gitolite-test .* $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list"
@ -58,8 +58,8 @@ do
echo R gitweb | runlocal ssh u1 setperms bar/u1/try2 echo R gitweb | runlocal ssh u1 setperms bar/u1/try2
expect "READERS gitweb" expect "READERS gitweb"
runremote ls -al repositories/bar/u1/try2.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try2.git/git-daemon-export-ok
expect "ls: cannot access repositories/bar/u1/try2.git/git-daemon-export-ok: No such file or directory" expect "ls: cannot access $TEST_BASE/bar/u1/try2.git/git-daemon-export-ok: No such file or directory"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 16 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 16 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 28 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 28 .* projects.list"
@ -70,8 +70,8 @@ do
name "add default daemon access" name "add default daemon access"
runlocal git ls-remote u1:bar/u1/try3 runlocal git ls-remote u1:bar/u1/try3
runremote ls -al repositories/bar/u1/try3.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try3.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try3.git/git-daemon-export-ok" expect "gitolite-test gitolite-test .* $TEST_BASE/bar/u1/try3.git/git-daemon-export-ok"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 16 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 16 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 28 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 28 .* projects.list"
@ -82,8 +82,8 @@ do
echo "\$GL_WILDREPOS_DEFPERMS = 'R gitweb';" | addrc echo "\$GL_WILDREPOS_DEFPERMS = 'R gitweb';" | addrc
runlocal git ls-remote u1:bar/u1/try4 runlocal git ls-remote u1:bar/u1/try4
runremote ls -al repositories/bar/u1/try4.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try4.git/git-daemon-export-ok
expect "ls: cannot access repositories/bar/u1/try4.git/git-daemon-export-ok: No such file or directory" expect "ls: cannot access $TEST_BASE/bar/u1/try4.git/git-daemon-export-ok: No such file or directory"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 32 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 32 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 44 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 44 .* projects.list"
@ -94,8 +94,8 @@ do
echo "\$GL_WILDREPOS_DEFPERMS = 'R daemon gitweb';" | addrc echo "\$GL_WILDREPOS_DEFPERMS = 'R daemon gitweb';" | addrc
runlocal git ls-remote u1:bar/u1/try5 runlocal git ls-remote u1:bar/u1/try5
runremote ls -al repositories/bar/u1/try5.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try5.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try5.git/git-daemon-export-ok" expect "gitolite-test gitolite-test .* $TEST_BASE/bar/u1/try5.git/git-daemon-export-ok"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 48 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 48 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 60 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 60 .* projects.list"
@ -106,8 +106,8 @@ do
echo "\$GL_WILDREPOS_DEFPERMS = 'R @all daemon gitweb';" | addrc echo "\$GL_WILDREPOS_DEFPERMS = 'R @all daemon gitweb';" | addrc
runlocal git ls-remote u1:bar/u1/try6 runlocal git ls-remote u1:bar/u1/try6
runremote ls -al repositories/bar/u1/try6.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try6.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try6.git/git-daemon-export-ok" expect "gitolite-test gitolite-test .* $TEST_BASE/bar/u1/try6.git/git-daemon-export-ok"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 64 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 64 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 76 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 76 .* projects.list"
@ -118,8 +118,8 @@ do
< /dev/null runlocal ssh u1 setperms bar/u1/try6 < /dev/null runlocal ssh u1 setperms bar/u1/try6
runlocal git ls-remote u1:bar/u1/try6 runlocal git ls-remote u1:bar/u1/try6
runremote ls -al repositories/bar/u1/try6.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try6.git/git-daemon-export-ok
expect "ls: cannot access repositories/bar/u1/try6.git/git-daemon-export-ok: No such file or directory" expect "ls: cannot access $TEST_BASE/bar/u1/try6.git/git-daemon-export-ok: No such file or directory"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 48 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 48 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 60 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 60 .* projects.list"
@ -130,9 +130,9 @@ do
echo "\$GL_WILDREPOS_DEFPERMS = 'R @all';" | addrc echo "\$GL_WILDREPOS_DEFPERMS = 'R @all';" | addrc
runlocal git ls-remote u1:bar/u1/try7 runlocal git ls-remote u1:bar/u1/try7
runremote ls -al repositories/bar/u1/try7.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try7.git/git-daemon-export-ok
[ "$ais" = "0" ] && expect "ls: cannot access repositories/bar/u1/try7.git/git-daemon-export-ok: No such file or directory" [ "$ais" = "0" ] && expect "ls: cannot access $TEST_BASE/bar/u1/try7.git/git-daemon-export-ok: No such file or directory"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test .* repositories/bar/u1/try7.git/git-daemon-export-ok" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test .* $TEST_BASE/bar/u1/try7.git/git-daemon-export-ok"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 48 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 48 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 76 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 76 .* projects.list"
@ -144,8 +144,8 @@ do
echo "\$GL_WILDREPOS_DEFPERMS = 'R daemon';" | addrc echo "\$GL_WILDREPOS_DEFPERMS = 'R daemon';" | addrc
runlocal git ls-remote u1:bar/u1/try8 runlocal git ls-remote u1:bar/u1/try8
runremote ls -al repositories/bar/u1/try8.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try8.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try8.git/git-daemon-export-ok" expect "gitolite-test gitolite-test .* $TEST_BASE/bar/u1/try8.git/git-daemon-export-ok"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 48 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 48 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 76 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 76 .* projects.list"
@ -156,8 +156,8 @@ do
echo "\$GL_WILDREPOS_DEFPERMS = 'R gitweb';" | addrc echo "\$GL_WILDREPOS_DEFPERMS = 'R gitweb';" | addrc
runlocal git ls-remote u1:bar/u1/try9 runlocal git ls-remote u1:bar/u1/try9
runremote ls -al repositories/bar/u1/try9.git/git-daemon-export-ok runremote ls -al $TEST_BASE/bar/u1/try9.git/git-daemon-export-ok
expect "ls: cannot access repositories/bar/u1/try9.git/git-daemon-export-ok: No such file or directory" expect "ls: cannot access $TEST_BASE/bar/u1/try9.git/git-daemon-export-ok: No such file or directory"
runremote ls -al projects.list runremote ls -al projects.list
[ "$ais" = "0" ] && expect "gitolite-test gitolite-test 64 .* projects.list" [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 64 .* projects.list"
[ "$ais" = "1" ] && expect "gitolite-test gitolite-test 92 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 92 .* projects.list"

View file

@ -23,7 +23,7 @@ do
name "u1 auto-creates a repo" name "u1 auto-creates a repo"
runlocal git ls-remote u1:bar/u1/try1 runlocal git ls-remote u1:bar/u1/try1
expect "Initialized empty Git repository in /home/gitolite-test/repositories/bar/u1/try1.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/bar/u1/try1.git/"
name "default permissions for u2 and u4" name "default permissions for u2 and u4"
runlocal ssh u1 expand runlocal ssh u1 expand
expect R.*W.*u1.*bar/u1/try1 expect R.*W.*u1.*bar/u1/try1

View file

@ -25,7 +25,7 @@ do
cd ~/td cd ~/td
runlocal git clone u1:u1/r1 runlocal git clone u1:u1/r1
expect "Initialized empty Git repository in /home/gitolite-test/repositories/u1/r1.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/u1/r1.git/"
cd r1 cd r1
mdc r1file1 mdc r1file1
runlocal git push origin master runlocal git push origin master
@ -52,7 +52,7 @@ do
cd ~/td cd ~/td
rm -rf r1 rm -rf r1
runlocal git clone u3:u3/r1 runlocal git clone u3:u3/r1
expect "Initialized empty Git repository in /home/gitolite-test/repositories/u3/r1.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/u3/r1.git/"
cd r1 cd r1
mdc r1file1 mdc r1file1
runlocal git push origin master runlocal git push origin master

View file

@ -32,7 +32,7 @@ do
name "make foo/u1/u1r1" name "make foo/u1/u1r1"
rm -rf ~/td/u1r1 rm -rf ~/td/u1r1
runlocal git clone u1:foo/u1/u1r1 runlocal git clone u1:foo/u1/u1r1
expect "Initialized empty Git repository in /home/gitolite-test/repositories/foo/u1/u1r1.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/foo/u1/u1r1.git/"
cd ~/td/u1r1 cd ~/td/u1r1
name "CREATOR can push" name "CREATOR can push"

View file

@ -43,7 +43,7 @@ do
name "u2 create and push bar/u2/r1" name "u2 create and push bar/u2/r1"
cd ~/td cd ~/td
runlocal git clone u2:bar/u2/r1 runlocal git clone u2:bar/u2/r1
expect "Initialized empty Git repository in /home/gitolite-test/repositories/bar/u2/r1.git/" expect "Initialized empty Git repository in $TEST_BASE_FULL/bar/u2/r1.git/"
expect "warning: You appear to have cloned an empty repository." expect "warning: You appear to have cloned an empty repository."
cd r1 cd r1
mdc; mdc mdc; mdc
@ -107,9 +107,9 @@ do
echo foo down|runlocal ssh gitolite able dis foo echo foo down|runlocal ssh gitolite able dis foo
expect "disabling following locations with message:" expect "disabling following locations with message:"
expect "foo down" expect "foo down"
expect "/home/gitolite-test/repositories/foo.git" expect "$TEST_BASE/foo.git"
runremote ls -al /home/gitolite-test/repositories/foo.git/.gitolite.down runremote ls -al $TEST_BASE/foo.git/.gitolite.down
expect ".rw------- 1 gitolite-test gitolite-test .* ..:.. /home/gitolite-test/repositories/foo.git/.gitolite.down" expect ".rw------- 1 gitolite-test gitolite-test .* ..:.. $TEST_BASE/foo.git/.gitolite.down"
name "u1 push foo fail" name "u1 push foo fail"
cd ~/td/foo cd ~/td/foo
@ -129,15 +129,15 @@ do
runlocal ssh u1 able en foo runlocal ssh u1 able en foo
expect "just .what. are you trying to pull, young man" expect "just .what. are you trying to pull, young man"
runlocal ssh gitolite able en foo runlocal ssh gitolite able en foo
expect "removed ./home/gitolite-test/repositories/foo.git/.gitolite.down." expect "removed .$TEST_BASE_FULL/foo.git/.gitolite.down."
echo bar/u2/r1 down | runlocal ssh u1 able dis foo echo bar/u2/r1 down | runlocal ssh u1 able dis foo
expect "just .what. are you trying to pull, young man" expect "just .what. are you trying to pull, young man"
echo bar/u2/r1 down | runlocal ssh gitolite able dis bar/u2/r1 echo bar/u2/r1 down | runlocal ssh gitolite able dis bar/u2/r1
expect "disabling following locations with message:" expect "disabling following locations with message:"
expect "bar/u2/r1 down" expect "bar/u2/r1 down"
expect "/home/gitolite-test/repositories/bar/u2/r1.git" expect "$TEST_BASE/bar/u2/r1.git"
runremote ls -al /home/gitolite-test/repositories/bar/u2/r1.git/.gitolite.down runremote ls -al $TEST_BASE/bar/u2/r1.git/.gitolite.down
expect ".rw------- 1 gitolite-test gitolite-test .. ... .. ..:.. /home/gitolite-test/repositories/bar/u2/r1.git/.gitolite.down" expect ".rw------- 1 gitolite-test gitolite-test .. ... .. ..:.. $TEST_BASE/bar/u2/r1.git/.gitolite.down"
name "u1 push foo" name "u1 push foo"
cd ~/td/foo cd ~/td/foo

View file

@ -56,9 +56,9 @@ do
name "setup: child is cloned and adds b1 and b2" name "setup: child is cloned and adds b1 and b2"
cd ~/td cd ~/td
runlocal ssh u2 fork r1 child/u2/myr1 runlocal ssh u2 fork r1 child/u2/myr1
runremote ls -al repositories/child/u2/myr1.git/gl-forked-from runremote ls -al $TEST_BASE/child/u2/myr1.git/gl-forked-from
expect "gitolite-test gitolite-test 3 .* repositories/child/u2/myr1.git/gl-forked-from" expect "gitolite-test gitolite-test 3 .* $TEST_BASE/child/u2/myr1.git/gl-forked-from"
runremote cat repositories/child/u2/myr1.git/gl-forked-from runremote cat $TEST_BASE/child/u2/myr1.git/gl-forked-from
expect r1 expect r1
runlocal git clone u2:child/u2/myr1 runlocal git clone u2:child/u2/myr1
cd myr1 cd myr1
@ -136,7 +136,7 @@ do
echo | runlocal ssh u1 hub fetch r1 3 echo | runlocal ssh u1 hub fetch r1 3
expect "user u2 asked you to" expect "user u2 asked you to"
expect "git fetch git://gl.example.com/child/u2/myr1 b3" expect "git fetch git://gl.example.com/child/u2/myr1 b3"
expect "From /home/gitolite-test/repositories/child/u2/myr1" expect "From $TEST_BASE_FULL/child/u2/myr1"
expect "\* \[new branch\] b3 -> requests/child/b3" expect "\* \[new branch\] b3 -> requests/child/b3"
name "bob checks his pending requests" name "bob checks his pending requests"

View file

@ -1,8 +1,14 @@
#!/bin/bash #!/bin/bash
# see some sample tests for how to use these functions; there is not # see some sample tests for how to use these functions; there is no
# documentation # documentation
# REPO_BASE has 2 manifestations in the output of various commands
export TEST_BASE=$(perl -e 'do "../conf/example.gitolite.rc"; print $REPO_BASE')
[ -z "$TEST_BASE" ] && { echo TEST_BASE not set >&2; exit 1; }
TEST_BASE_FULL=$TEST_BASE
[ "$TEST_BASE" = "repositories" ] && TEST_BASE_FULL=/home/gitolite-test/repositories
testnum=0 testnum=0
# remote local command # remote local command
@ -10,14 +16,14 @@ runlocal() { "$@" > ~/1 2> ~/2; }
# remote run command # remote run command
runremote() { ssh gitolite-test@localhost "$@" > ~/1 2> ~/2; } runremote() { ssh gitolite-test@localhost "$@" > ~/1 2> ~/2; }
# remote list repositories # remote list repositories
listrepos() { ssh gitolite-test@localhost find repositories -type d -name "*.git" | sort > ~/1 2> ~/2; } listrepos() { ssh gitolite-test@localhost "cd $TEST_BASE; find . -type d -name '*.git'" | sort > ~/1 2> ~/2; }
# remote cat compiled pm # remote cat compiled pm
catconf() { ssh gitolite-test@localhost cat .gitolite/conf/gitolite.conf-compiled.pm > ~/1 2> ~/2; } catconf() { ssh gitolite-test@localhost cat .gitolite/conf/gitolite.conf-compiled.pm > ~/1 2> ~/2; }
catconfs() { catconfs() {
( (
ssh gitolite-test@localhost cat .gitolite/conf/gitolite.conf-compiled.pm ssh gitolite-test@localhost cat .gitolite/conf/gitolite.conf-compiled.pm
ssh gitolite-test@localhost find repositories -name gl-conf \| sort ssh gitolite-test@localhost "cd $TEST_BASE; find . -name gl-conf | sort"
ssh gitolite-test@localhost find repositories -name gl-conf \| sort \| xargs cat ssh gitolite-test@localhost "cd $TEST_BASE; find . -name gl-conf | sort | xargs cat"
) > ~/1 2> ~/2 ) > ~/1 2> ~/2
} }
# remote cat ~/.gitolite.rc # remote cat ~/.gitolite.rc

View file

@ -12,3 +12,4 @@ src/gl-easy-install -q gitolite-test localhost tester
cd cd
tar cf rollback.tar gitolite-admin tar cf rollback.tar gitolite-admin
ssh gitolite-test@localhost tar cf rollback.tar .ssh .gitolite .gitolite.rc repositories gitolite-install ssh gitolite-test@localhost tar cf rollback.tar .ssh .gitolite .gitolite.rc repositories gitolite-install
ssh gitolite-test@localhost tar -C /tmp -cf \$HOME/rollback2.tar glrb