From 6539009cb5eb9295452a2588c8aad1171055b431 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Fri, 18 Mar 2011 10:59:52 +0530 Subject: [PATCH] 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! --- src/gitolite.pm | 26 +++++++------ src/gitolite_rc.pm | 3 ++ src/gl-auth-command | 6 +-- src/gl-compile-conf | 12 ++---- src/gl-install | 8 +--- t/install-gitolite | 4 +- t/out/t01-repo-groups.1bs | 8 ++-- t/out/t01-repo-groups.2 | 4 +- t/out/t02-user-groups.1bs | 6 +-- t/out/t02-user-groups.2bs | 6 +-- t/rollback.server | 3 +- t/t00-initial | 2 +- t/t04a-wild-all | 6 +-- t/t04a-wild-students | 2 +- t/t05a-delegation | 2 +- t/t50-sequence-test | 2 +- t/t53-check-info-expand-output | 2 +- t/t54-repo-configs | 8 ++-- t/t55-repo-configs-wild-without-CREATOR | 14 +++---- t/t56-repo-configs-wild-with-CREATOR | 14 +++---- t/t57-daemon-gitweb | 30 +++++++-------- t/t58-daemon-gitweb-wild | 34 ++++++++--------- t/t59-repo-not-on-disk | 10 ++--- t/t60-daemon-gitweb-via-setperms | 50 ++++++++++++------------- t/t61-setperms-groups | 2 +- t/t62-rule-sequences | 4 +- t/t63-perm-cats | 2 +- t/t64-write-able | 16 ++++---- t/t67-hub | 8 ++-- t/test-driver.sh | 14 +++++-- t/update-gitolite | 1 + 31 files changed, 158 insertions(+), 151 deletions(-) diff --git a/src/gitolite.pm b/src/gitolite.pm index 82986f9..9d636bd 100644 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@ -171,7 +171,7 @@ sub list_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`) { chomp ($repo); $repo =~ s(\./(.*)\.git$)($1); @@ -250,7 +250,7 @@ sub new_repo sub new_wild_repo { my ($repo, $user) = @_; - wrap_chdir("$ENV{GL_REPO_BASE_ABS}"); + wrap_chdir($REPO_BASE); new_repo($repo, "$GL_ADMINDIR/hooks/common", $user); # note pwd is now the bare "repo.git"; new_repo does that... wrap_print("gl-perms", "$GL_WILDREPOS_DEFPERMS\n") if $GL_WILDREPOS_DEFPERMS; @@ -294,8 +294,8 @@ sub new_wild_repo { # creator my $c = ''; - if ( -f "$ENV{GL_REPO_BASE_ABS}/$repo.git/gl-creater") { - my $fh = wrap_open("<", "$ENV{GL_REPO_BASE_ABS}/$repo.git/gl-creater"); + if ( -f "$REPO_BASE/$repo.git/gl-creater") { + my $fh = wrap_open("<", "$REPO_BASE/$repo.git/gl-creater"); chomp($c = <$fh>); } @@ -308,8 +308,8 @@ sub new_wild_repo { # "WRITERS=>foo" and "TESTERS=>@all" my %perm_cats; - if ($user and -f "$ENV{GL_REPO_BASE_ABS}/$repo.git/gl-perms") { - my $fh = wrap_open("<", "$ENV{GL_REPO_BASE_ABS}/$repo.git/gl-perms"); + if ($user and -f "$REPO_BASE/$repo.git/gl-perms") { + my $fh = wrap_open("<", "$REPO_BASE/$repo.git/gl-perms"); my $perms = join ("", <$fh>); # discard comments $perms =~ s/#.*//g; @@ -353,7 +353,7 @@ sub get_set_perms $GL_WILDREPOS_PERM_CATS ||= "READERS WRITERS"; my ($creator, $dummy, $dummy2) = wild_repo_rights($repo, ""); 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"); if ($verb eq 'getperms') { return unless -f "gl-perms"; @@ -390,7 +390,7 @@ sub get_set_desc my($repo, $verb, $user) = @_; my ($creator, $dummy, $dummy2) = wild_repo_rights($repo, ""); 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"); if ($verb eq 'getdesc') { 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 # 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; for my $actual_repo (`find . -type d -name "*.git" -prune|sort`) { chomp ($actual_repo); @@ -665,7 +665,7 @@ sub add_repo_conf { my ($repo) = shift; 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}; $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 where_is_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 = ' '; @@ -701,7 +703,7 @@ sub add_repo_conf # get basic info about the repo and fill %repos my $wild = ''; - my $exists = -d "$ENV{GL_REPO_BASE_ABS}/$repo.git"; + my $exists = -d "$REPO_BASE/$repo.git"; if ($exists) { # 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 @@ -768,7 +770,7 @@ sub can_read { # helper to manage "disabling" a repo or the whole site for "W" access sub check_repo_write_enabled { 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; die $ABRT . slurp($d) if -s $d; die $ABRT . "writes are currently disabled\n"; diff --git a/src/gitolite_rc.pm b/src/gitolite_rc.pm index 09cd172..cb7e674 100644 --- a/src/gitolite_rc.pm +++ b/src/gitolite_rc.pm @@ -65,6 +65,9 @@ for ("$ENV{HOME}/.gitolite.rc", "/etc/gitolite/gitolite.rc") { die "no rc file found\n" unless $ENV{GL_RC}; 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: 1; diff --git a/src/gl-auth-command b/src/gl-auth-command index 754bfad..60f0e40 100755 --- a/src/gl-auth-command +++ b/src/gl-auth-command @@ -142,7 +142,7 @@ $ENV{GL_REPO}=$repo; # first level permissions check 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'; } else { ($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 # 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. -if (-x "$ENV{GL_REPO_BASE_ABS}/$repo.git/hooks/gl-pre-git") { - system("cd $ENV{GL_REPO_BASE_ABS}/$repo.git; hooks/gl-pre-git $aa >&2"); +if (-x "$REPO_BASE/$repo.git/hooks/gl-pre-git") { + system("cd $REPO_BASE/$repo.git; hooks/gl-pre-git $aa >&2"); die "gl-pre-git hook failed ($?)\n" if $?; } diff --git a/src/gl-compile-conf b/src/gl-compile-conf index 6154eb7..f0bfdf1 100755 --- a/src/gl-compile-conf +++ b/src/gl-compile-conf @@ -383,10 +383,6 @@ die "\n\t\t***** AAARGH! *****\n" . # 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 # (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 @@ -400,7 +396,7 @@ write_compiled_conf(); # write out the final compiled config 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 my @repos = grep { $_ =~ $REPONAME_PATT and not /^@/ } sort keys %repos; @@ -419,7 +415,7 @@ sub do_normal_repos print STDERR "creating $repo...\n"; new_repo($repo, "$GL_ADMINDIR/hooks/common"); # 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 @@ -520,13 +516,13 @@ my %projlist = (); # sub parse_acl (look for variable $saved_crwu) for my $repo (@phy_repos) { - wrap_chdir("$ENV{GL_REPO_BASE_ABS}/$repo.git"); + wrap_chdir("$REPO_BASE/$repo.git"); # daemon is easy setup_daemon_access($repo); } 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: # - "setup_gitweb_access" also sets "owner", despite the name # - specifying a description also counts as enabling gitweb diff --git a/src/gl-install b/src/gl-install index 4eb9e0a..cd1702a 100755 --- a/src/gl-install +++ b/src/gl-install @@ -53,9 +53,6 @@ unless ($ENV{GL_RC}) { 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 $ENV{PATH} .= ":$GIT_PATH" if $GIT_PATH; @@ -63,8 +60,7 @@ $ENV{PATH} .= ":$GIT_PATH" if $GIT_PATH; umask($REPO_UMASK); # 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($ENV{GL_REPO_BASE_ABS}); +wrap_mkdir($REPO_BASE); wrap_mkdir($GL_ADMINDIR, 0700); # mkdir $GL_ADMINDIR's subdirs 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 -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`) { chomp ($repo); # propagate our own, plus any local admin-defined, hooks diff --git a/t/install-gitolite b/t/install-gitolite index fd02b85..973685a 100755 --- a/t/install-gitolite +++ b/t/install-gitolite @@ -16,7 +16,7 @@ chmod 600 ~/.ssh/u? # blank out the server side 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 ssh-copy-id -i ~/.ssh/id_rsa gitolite-test@localhost echo the next command should NOT ask for a password @@ -33,4 +33,6 @@ git push # make the rollback.tar files on both sides cd 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 -C /tmp -cf \$HOME/rollback2.tar glrb diff --git a/t/out/t01-repo-groups.1bs b/t/out/t01-repo-groups.1bs index 944fac4..a606c7a 100644 --- a/t/out/t01-repo-groups.1bs +++ b/t/out/t01-repo-groups.1bs @@ -6,10 +6,10 @@ $data_version = '1.7'; 'gitolite-admin' => 1, 'testing' => 1 ); -repositories/aa.git/gl-conf -repositories/bb.git/gl-conf -repositories/gitolite-admin.git/gl-conf -repositories/testing.git/gl-conf +./aa.git/gl-conf +./bb.git/gl-conf +./gitolite-admin.git/gl-conf +./testing.git/gl-conf %one_repo = ( 'aa' => { 'R' => { diff --git a/t/out/t01-repo-groups.2 b/t/out/t01-repo-groups.2 index 5b6a9aa..25131c9 100644 --- a/t/out/t01-repo-groups.2 +++ b/t/out/t01-repo-groups.2 @@ -35,8 +35,8 @@ $data_version = '1.7'; 'gitolite-admin' => 1, 'testing' => 1 ); -repositories/gitolite-admin.git/gl-conf -repositories/testing.git/gl-conf +./gitolite-admin.git/gl-conf +./testing.git/gl-conf %one_repo = ( 'gitolite-admin' => { 'R' => { diff --git a/t/out/t02-user-groups.1bs b/t/out/t02-user-groups.1bs index 54d8b4a..9a36428 100644 --- a/t/out/t02-user-groups.1bs +++ b/t/out/t02-user-groups.1bs @@ -5,9 +5,9 @@ $data_version = '1.7'; 'gitolite-admin' => 1, 'testing' => 1 ); -repositories/aa.git/gl-conf -repositories/gitolite-admin.git/gl-conf -repositories/testing.git/gl-conf +./aa.git/gl-conf +./gitolite-admin.git/gl-conf +./testing.git/gl-conf %one_repo = ( 'aa' => { 'R' => { diff --git a/t/out/t02-user-groups.2bs b/t/out/t02-user-groups.2bs index 0fc09d0..09e1a33 100644 --- a/t/out/t02-user-groups.2bs +++ b/t/out/t02-user-groups.2bs @@ -19,9 +19,9 @@ $data_version = '1.7'; 'gitolite-admin' => 1, 'testing' => 1 ); -repositories/aa.git/gl-conf -repositories/gitolite-admin.git/gl-conf -repositories/testing.git/gl-conf +./aa.git/gl-conf +./gitolite-admin.git/gl-conf +./testing.git/gl-conf %one_repo = ( 'aa' => { '@g1' => [ diff --git a/t/rollback.server b/t/rollback.server index f8b84ec..ce26d80 100755 --- a/t/rollback.server +++ b/t/rollback.server @@ -1,8 +1,9 @@ #!/bin/bash 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 +( cd /tmp; tar xf ~/rollback2.tar ) # if arg1 is a directory, we have to overwrite sources from there (see commit # message for details) diff --git a/t/t00-initial b/t/t00-initial index bfc97b4..c0825c2 100644 --- a/t/t00-initial +++ b/t/t00-initial @@ -13,7 +13,7 @@ expect "To gitolite:gitolite-admin" expect "master -> master" 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" diff --git a/t/t04a-wild-all b/t/t04a-wild-all index 1b6ebf0..951c9b4 100644 --- a/t/t04a-wild-all +++ b/t/t04a-wild-all @@ -22,12 +22,12 @@ cd ~/td name "u1 create success" 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" name "u2 create success" 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" 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" 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." name "u4 push success" diff --git a/t/t04a-wild-students b/t/t04a-wild-students index ad674ad..1b385ed 100644 --- a/t/t04a-wild-students +++ b/t/t04a-wild-students @@ -38,7 +38,7 @@ expect "R access for foo/u4/a1234 DENIED to u4" name "u4 tries to create his own repo" 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." name "u4 push success" diff --git a/t/t05a-delegation b/t/t05a-delegation index 8fcdbca..ba9ecef 100644 --- a/t/t05a-delegation +++ b/t/t05a-delegation @@ -30,7 +30,7 @@ echo " " > conf/fragments/u1r.conf ugc < /dev/null 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 "master -> master" diff --git a/t/t50-sequence-test b/t/t50-sequence-test index ef4aced..528796a 100644 --- a/t/t50-sequence-test +++ b/t/t50-sequence-test @@ -21,7 +21,7 @@ do cd ~/td 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 mdc u1file1 diff --git a/t/t53-check-info-expand-output b/t/t53-check-info-expand-output index 7ab8f9e..b1f55f8 100644 --- a/t/t53-check-info-expand-output +++ b/t/t53-check-info-expand-output @@ -26,7 +26,7 @@ do runlocal git clone u1:foo/u1/bar [ "$wr" = "0" ] && expect "R access for foo/u1/bar DENIED to u1" [ "$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" runlocal git clone u3:foo/u3/baz diff --git a/t/t54-repo-configs b/t/t54-repo-configs index e14051f..d0fe8cf 100644 --- a/t/t54-repo-configs +++ b/t/t54-repo-configs @@ -45,10 +45,10 @@ do RW = @devs config foo.bar = baz " | 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" expect_push_ok "master -> master" - runremote cat repositories/bar.git/config + runremote cat $TEST_BASE/bar.git/config expect '^.foo' expect 'bar = baz' @@ -65,7 +65,7 @@ do config foobar.baz = ooka " | ugc -r expect "remote: git config foobar.baz not allowed" - runremote cat repositories/bar.git/config + runremote cat $TEST_BASE/bar.git/config expect '^.foo' expect 'bar = baz' notexpect '^.foobar' @@ -82,7 +82,7 @@ do RW = @devs config foo.bar = " | ugc -r - runremote cat repositories/bar.git/config + runremote cat $TEST_BASE/bar.git/config expect '^.foo' notexpect 'bar = baz' diff --git a/t/t55-repo-configs-wild-without-CREATOR b/t/t55-repo-configs-wild-without-CREATOR index 256c25c..af0bd0e 100644 --- a/t/t55-repo-configs-wild-without-CREATOR +++ b/t/t55-repo-configs-wild-without-CREATOR @@ -71,10 +71,10 @@ do name "u1 create 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" - runremote cat repositories/bar/try1.git/config + runremote cat $TEST_BASE/bar/try1.git/config expect '^.foo' expect 'bar = baz' @@ -93,16 +93,16 @@ do expect_push_ok "master -> master" 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 notexpect 'bar = baz' name "u2 create 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" - 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 'bar = baz' @@ -121,12 +121,12 @@ do expect_push_ok "master -> master" name "check u1 has foo.frob" - runremote cat repositories/bar/try1.git/config + runremote cat $TEST_BASE/bar/try1.git/config expect '^.foo' expect 'frob = nitz' name "check u2 has foo.frob" - runremote cat repositories/bar/try2.git/config + runremote cat $TEST_BASE/bar/try2.git/config expect '^.foo' expect 'frob = nitz' diff --git a/t/t56-repo-configs-wild-with-CREATOR b/t/t56-repo-configs-wild-with-CREATOR index 71bee9c..ca0977e 100644 --- a/t/t56-repo-configs-wild-with-CREATOR +++ b/t/t56-repo-configs-wild-with-CREATOR @@ -65,10 +65,10 @@ do name "u1 create 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" - runremote cat repositories/bar/u1/try1.git/config + runremote cat $TEST_BASE/bar/u1/try1.git/config expect '^.foo' expect 'bar = baz' @@ -86,16 +86,16 @@ do expect_push_ok "master -> master" 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 notexpect 'bar = baz' name "u2 create 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" - 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 'bar = baz' @@ -113,12 +113,12 @@ do expect_push_ok "master -> master" 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 'frob = nitz' 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 'frob = nitz' diff --git a/t/t57-daemon-gitweb b/t/t57-daemon-gitweb index 93397c5..52701d0 100644 --- a/t/t57-daemon-gitweb +++ b/t/t57-daemon-gitweb @@ -15,9 +15,9 @@ do name "INTERNAL" echo|ugc name "daemon access for testing repo" - runremote ls -al repositories/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" = "1" ] && expect "gitolite-test gitolite-test .* repositories/testing.git/git-daemon-export-ok" + runremote ls -al $TEST_BASE/testing.git/git-daemon-export-ok + [ "$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 .* $TEST_BASE/testing.git/git-daemon-export-ok" name "INTERNAL" echo " @@ -30,8 +30,8 @@ do RW = @devs " | ugc expect_push_ok "master -> master" - runremote ls -al repositories/bar.git/git-daemon-export-ok - expect "ls: cannot access repositories/bar.git/git-daemon-export-ok: No such file or directory" + runremote ls -al $TEST_BASE/bar.git/git-daemon-export-ok + expect "ls: cannot access $TEST_BASE/bar.git/git-daemon-export-ok: No such file or directory" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" @@ -43,8 +43,8 @@ do echo " R = daemon " | ugc - runremote ls -al repositories/bar.git/git-daemon-export-ok - expect "gitolite-test gitolite-test .* repositories/bar.git/git-daemon-export-ok" + runremote ls -al $TEST_BASE/bar.git/git-daemon-export-ok + expect "gitolite-test gitolite-test .* $TEST_BASE/bar.git/git-daemon-export-ok" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" @@ -93,7 +93,7 @@ do baz = \"this is repo baz\" " | ugc 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 [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 24 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 36 .* projects.list" @@ -103,9 +103,9 @@ do expect "foo.git" expect "bar.git" expect "baz.git" - runremote ls -al repositories/baz.git/description - expect "gitolite-test gitolite-test 17 .* repositories/baz.git/description" - runremote cat repositories/baz.git/description + runremote ls -al $TEST_BASE/baz.git/description + expect "gitolite-test gitolite-test 17 .* $TEST_BASE/baz.git/description" + runremote cat $TEST_BASE/baz.git/description expect "this is repo baz" name "add owner to testing repo" @@ -120,12 +120,12 @@ do expect "foo.git" expect "bar.git" expect "baz.git" - runremote cat repositories/testing.git/config + runremote cat $TEST_BASE/testing.git/config expect "\[gitweb\]" expect "owner = sitaram" - runremote ls -al repositories/testing.git/description - expect "gitolite-test gitolite-test 25 .* repositories/testing.git/description" - runremote cat repositories/testing.git/description + runremote ls -al $TEST_BASE/testing.git/description + expect "gitolite-test gitolite-test 25 .* $TEST_BASE/testing.git/description" + runremote cat $TEST_BASE/testing.git/description expect "this is the testing repo" name INTERNAL diff --git a/t/t58-daemon-gitweb-wild b/t/t58-daemon-gitweb-wild index c22a52c..d0bee20 100644 --- a/t/t58-daemon-gitweb-wild +++ b/t/t58-daemon-gitweb-wild @@ -24,8 +24,8 @@ do " | ugc expect_push_ok "master -> master" runlocal git ls-remote u1:bar/u1/try1 - runremote ls -al repositories/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" + runremote ls -al $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok + expect "ls: cannot access $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok: No such file or directory" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" @@ -38,16 +38,16 @@ do echo " R = daemon " | ugc - runremote ls -al repositories/bar/u1/try1.git/git-daemon-export-ok - expect "gitolite-test gitolite-test .* 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 .* $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" name "add one more repo" runlocal git ls-remote u1:bar/u1/try2 - runremote ls -al repositories/bar/u1/try2.git/git-daemon-export-ok - expect "gitolite-test gitolite-test .* 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 .* $TEST_BASE/bar/u1/try2.git/git-daemon-export-ok" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" @@ -71,13 +71,13 @@ do expect "bar/u1/try1.git" notexpect "bar/u1/try2.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" name "add try3 project" runlocal git ls-remote u1:bar/u1/try3 - runremote ls -al repositories/bar/u1/try3.git/git-daemon-export-ok - expect "gitolite-test gitolite-test .* 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 .* $TEST_BASE/bar/u1/try3.git/git-daemon-export-ok" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 16 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 28 .* projects.list" @@ -87,16 +87,16 @@ do expect "bar/u1/try1.git" notexpect "bar/u1/try2.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" - 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." name "now compile and recheck try3 stuff" echo " " | ugc - runremote ls -al repositories/bar/u1/try3.git/git-daemon-export-ok - expect "gitolite-test gitolite-test .* 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 .* $TEST_BASE/bar/u1/try3.git/git-daemon-export-ok" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 32 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 44 .* projects.list" @@ -106,16 +106,16 @@ do expect "bar/u1/try1.git" notexpect "bar/u1/try2.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" - runremote cat repositories/bar/u1/try3.git/description + runremote cat $TEST_BASE/bar/u1/try3.git/description expect "this is bar/u1/try3" name "add owner for try2 and compile" echo " bar/u1/try2 \"owner2\" = \"this is bar/u1/try1\" " | ugc - runremote cat repositories/bar/u1/try2.git/config + runremote cat $TEST_BASE/bar/u1/try2.git/config expect "\[gitweb\]" expect "owner = owner2" runremote ls -al projects.list @@ -152,7 +152,7 @@ do expect "bar/u1/try2.git" expect "bar/u1/try3.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." name "INTERNAL" diff --git a/t/t59-repo-not-on-disk b/t/t59-repo-not-on-disk index 9f246f6..4665c87 100644 --- a/t/t59-repo-not-on-disk +++ b/t/t59-repo-not-on-disk @@ -19,7 +19,7 @@ do R = @g2 " | ugc 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 name "check u1 can auto-create and push" @@ -71,24 +71,24 @@ do expect "R access for aa DENIED to u6" # 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 name "repo on disk missing: u1" 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 "Or there may be no repository at the given path. Did you spell it correctly?" name "repo on disk missing: tester" 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 "Or there may be no repository at the given path. Did you spell it correctly?" name "repo on disk missing: u4" 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 "Or there may be no repository at the given path. Did you spell it correctly?" diff --git a/t/t60-daemon-gitweb-via-setperms b/t/t60-daemon-gitweb-via-setperms index c4b1485..b08718c 100644 --- a/t/t60-daemon-gitweb-via-setperms +++ b/t/t60-daemon-gitweb-via-setperms @@ -25,8 +25,8 @@ do expect_push_ok "master -> master" runlocal git ls-remote u1:bar/u1/try1 - runremote ls -al repositories/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" + runremote ls -al $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok + expect "ls: cannot access $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok: No such file or directory" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 12 .* projects.list" @@ -34,8 +34,8 @@ do notexpect "bar/u1/try1.git" runlocal git ls-remote u1:bar/u1/try2 - runremote ls -al repositories/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" + runremote ls -al $TEST_BASE/bar/u1/try2.git/git-daemon-export-ok + expect "ls: cannot access $TEST_BASE/bar/u1/try2.git/git-daemon-export-ok: No such file or directory" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* 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 expect "READERS daemon" - runremote ls -al repositories/bar/u1/try1.git/git-daemon-export-ok - expect "gitolite-test gitolite-test .* 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 .* $TEST_BASE/bar/u1/try1.git/git-daemon-export-ok" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 0 .* 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 expect "READERS gitweb" - runremote ls -al repositories/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" + runremote ls -al $TEST_BASE/bar/u1/try2.git/git-daemon-export-ok + expect "ls: cannot access $TEST_BASE/bar/u1/try2.git/git-daemon-export-ok: No such file or directory" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 16 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 28 .* projects.list" @@ -70,8 +70,8 @@ do name "add default daemon access" runlocal git ls-remote u1:bar/u1/try3 - runremote ls -al repositories/bar/u1/try3.git/git-daemon-export-ok - expect "gitolite-test gitolite-test .* 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 .* $TEST_BASE/bar/u1/try3.git/git-daemon-export-ok" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 16 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 28 .* projects.list" @@ -82,8 +82,8 @@ do echo "\$GL_WILDREPOS_DEFPERMS = 'R gitweb';" | addrc runlocal git ls-remote u1:bar/u1/try4 - runremote ls -al repositories/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" + runremote ls -al $TEST_BASE/bar/u1/try4.git/git-daemon-export-ok + expect "ls: cannot access $TEST_BASE/bar/u1/try4.git/git-daemon-export-ok: No such file or directory" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 32 .* 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 runlocal git ls-remote u1:bar/u1/try5 - runremote ls -al repositories/bar/u1/try5.git/git-daemon-export-ok - expect "gitolite-test gitolite-test .* 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 .* $TEST_BASE/bar/u1/try5.git/git-daemon-export-ok" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 48 .* 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 runlocal git ls-remote u1:bar/u1/try6 - runremote ls -al repositories/bar/u1/try6.git/git-daemon-export-ok - expect "gitolite-test gitolite-test .* 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 .* $TEST_BASE/bar/u1/try6.git/git-daemon-export-ok" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 64 .* 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 runlocal git ls-remote u1:bar/u1/try6 - runremote ls -al repositories/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" + runremote ls -al $TEST_BASE/bar/u1/try6.git/git-daemon-export-ok + expect "ls: cannot access $TEST_BASE/bar/u1/try6.git/git-daemon-export-ok: No such file or directory" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 48 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 60 .* projects.list" @@ -130,9 +130,9 @@ do echo "\$GL_WILDREPOS_DEFPERMS = 'R @all';" | addrc runlocal git ls-remote u1:bar/u1/try7 - runremote ls -al repositories/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" = "1" ] && expect "gitolite-test gitolite-test .* 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 $TEST_BASE/bar/u1/try7.git/git-daemon-export-ok: No such file or directory" + [ "$ais" = "1" ] && expect "gitolite-test gitolite-test .* $TEST_BASE/bar/u1/try7.git/git-daemon-export-ok" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 48 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 76 .* projects.list" @@ -144,8 +144,8 @@ do echo "\$GL_WILDREPOS_DEFPERMS = 'R daemon';" | addrc runlocal git ls-remote u1:bar/u1/try8 - runremote ls -al repositories/bar/u1/try8.git/git-daemon-export-ok - expect "gitolite-test gitolite-test .* 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 .* $TEST_BASE/bar/u1/try8.git/git-daemon-export-ok" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 48 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 76 .* projects.list" @@ -156,8 +156,8 @@ do echo "\$GL_WILDREPOS_DEFPERMS = 'R gitweb';" | addrc runlocal git ls-remote u1:bar/u1/try9 - runremote ls -al repositories/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" + runremote ls -al $TEST_BASE/bar/u1/try9.git/git-daemon-export-ok + expect "ls: cannot access $TEST_BASE/bar/u1/try9.git/git-daemon-export-ok: No such file or directory" runremote ls -al projects.list [ "$ais" = "0" ] && expect "gitolite-test gitolite-test 64 .* projects.list" [ "$ais" = "1" ] && expect "gitolite-test gitolite-test 92 .* projects.list" diff --git a/t/t61-setperms-groups b/t/t61-setperms-groups index 58506c2..f7f0087 100644 --- a/t/t61-setperms-groups +++ b/t/t61-setperms-groups @@ -23,7 +23,7 @@ do name "u1 auto-creates a repo" 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" runlocal ssh u1 expand expect R.*W.*u1.*bar/u1/try1 diff --git a/t/t62-rule-sequences b/t/t62-rule-sequences index 5e3de16..e4da9fe 100644 --- a/t/t62-rule-sequences +++ b/t/t62-rule-sequences @@ -25,7 +25,7 @@ do cd ~/td 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 mdc r1file1 runlocal git push origin master @@ -52,7 +52,7 @@ do cd ~/td rm -rf 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 mdc r1file1 runlocal git push origin master diff --git a/t/t63-perm-cats b/t/t63-perm-cats index 9f53fd5..257478c 100644 --- a/t/t63-perm-cats +++ b/t/t63-perm-cats @@ -32,7 +32,7 @@ do name "make foo/u1/u1r1" rm -rf ~/td/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 name "CREATOR can push" diff --git a/t/t64-write-able b/t/t64-write-able index 25c8d7f..10ec1fa 100644 --- a/t/t64-write-able +++ b/t/t64-write-able @@ -43,7 +43,7 @@ do name "u2 create and push bar/u2/r1" cd ~/td 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." cd r1 mdc; mdc @@ -107,9 +107,9 @@ do echo foo down|runlocal ssh gitolite able dis foo expect "disabling following locations with message:" expect "foo down" - expect "/home/gitolite-test/repositories/foo.git" - runremote ls -al /home/gitolite-test/repositories/foo.git/.gitolite.down - expect ".rw------- 1 gitolite-test gitolite-test .* ..:.. /home/gitolite-test/repositories/foo.git/.gitolite.down" + expect "$TEST_BASE/foo.git" + runremote ls -al $TEST_BASE/foo.git/.gitolite.down + expect ".rw------- 1 gitolite-test gitolite-test .* ..:.. $TEST_BASE/foo.git/.gitolite.down" name "u1 push foo fail" cd ~/td/foo @@ -129,15 +129,15 @@ do runlocal ssh u1 able en foo expect "just .what. are you trying to pull, young man" 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 expect "just .what. are you trying to pull, young man" echo bar/u2/r1 down | runlocal ssh gitolite able dis bar/u2/r1 expect "disabling following locations with message:" expect "bar/u2/r1 down" - expect "/home/gitolite-test/repositories/bar/u2/r1.git" - runremote ls -al /home/gitolite-test/repositories/bar/u2/r1.git/.gitolite.down - expect ".rw------- 1 gitolite-test gitolite-test .. ... .. ..:.. /home/gitolite-test/repositories/bar/u2/r1.git/.gitolite.down" + expect "$TEST_BASE/bar/u2/r1.git" + runremote ls -al $TEST_BASE/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" cd ~/td/foo diff --git a/t/t67-hub b/t/t67-hub index f3d19c0..68d4317 100644 --- a/t/t67-hub +++ b/t/t67-hub @@ -56,9 +56,9 @@ do name "setup: child is cloned and adds b1 and b2" cd ~/td runlocal ssh u2 fork r1 child/u2/myr1 - runremote ls -al repositories/child/u2/myr1.git/gl-forked-from - expect "gitolite-test gitolite-test 3 .* repositories/child/u2/myr1.git/gl-forked-from" - runremote cat 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 .* $TEST_BASE/child/u2/myr1.git/gl-forked-from" + runremote cat $TEST_BASE/child/u2/myr1.git/gl-forked-from expect r1 runlocal git clone u2:child/u2/myr1 cd myr1 @@ -136,7 +136,7 @@ do echo | runlocal ssh u1 hub fetch r1 3 expect "user u2 asked you to" 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" name "bob checks his pending requests" diff --git a/t/test-driver.sh b/t/test-driver.sh index 27ce7a1..ae88c5a 100755 --- a/t/test-driver.sh +++ b/t/test-driver.sh @@ -1,8 +1,14 @@ #!/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 +# 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 # remote local command @@ -10,14 +16,14 @@ runlocal() { "$@" > ~/1 2> ~/2; } # remote run command runremote() { ssh gitolite-test@localhost "$@" > ~/1 2> ~/2; } # 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 catconf() { ssh gitolite-test@localhost cat .gitolite/conf/gitolite.conf-compiled.pm > ~/1 2> ~/2; } catconfs() { ( 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 find repositories -name gl-conf \| sort \| xargs cat + ssh gitolite-test@localhost "cd $TEST_BASE; find . -name gl-conf | sort" + ssh gitolite-test@localhost "cd $TEST_BASE; find . -name gl-conf | sort | xargs cat" ) > ~/1 2> ~/2 } # remote cat ~/.gitolite.rc diff --git a/t/update-gitolite b/t/update-gitolite index 55af1ef..fab9924 100755 --- a/t/update-gitolite +++ b/t/update-gitolite @@ -12,3 +12,4 @@ src/gl-easy-install -q gitolite-test localhost tester cd 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 -C /tmp -cf \$HOME/rollback2.tar glrb