auth/compile: auto-vivify is default now, so:

the "create a new repo" code moves from compile to auth.

Only someone who has W access can create it, but he can do so even on a
"R" operation (like clone or ls-remote).

This is a pre-requisite for rebel's wildcard repos, where
autovivification is the only way you can create arbitrary repos matching
a pattern.

The only reason it's getting into master is because it looks cool!

----

OK that's a lie; the real reason is to keep the two branches as similar
as possible, though they;ve diverged quite a bit since the "only
one-line difference" days where "rebel" just meant "deny/exclude"
rules!)
This commit is contained in:
Sitaram Chamarty 2009-11-27 23:00:58 +05:30
parent c3b5e3b1af
commit b78a720cee
2 changed files with 14 additions and 16 deletions

View file

@ -100,6 +100,15 @@ die "$perm access for $repo DENIED to $user\n"
unless $repos{$repo}{$perm}{$user}
or $repos{$repo}{$perm}{'@all'};
# create the repo if it doesn't already exist and the user has "W" access
my $repo_base_abs = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$ENV{HOME}/$REPO_BASE" );
if ( ( $repos{$repo}{W}{$user}
or $repos{$repo}{W}{'@all'} ) and not -d "$repo_base_abs/$repo.git" ) {
wrap_chdir("$repo_base_abs");
new_repo($repo, "$GL_ADMINDIR/src/hooks");
wrap_chdir($ENV{HOME});
}
# ----------------------------------------------------------------------------
# logging, timestamp. also setup env vars for later
# ----------------------------------------------------------------------------

View file

@ -312,27 +312,12 @@ my $git_version = `git --version`;
my ($gv_maj, $gv_min, $gv_patchrel) = ($git_version =~ m/git version (\d+)\.(\d+)\.(\d+)/);
die "$ABRT I can't understand $git_version\n" unless ($gv_maj >= 1);
$git_version = $gv_maj*10000 + $gv_min*100 + $gv_patchrel; # now it's "normalised"
my $git_too_old = 0;
# repo-base needs to be an absolute path for this loop to work right
# so if it was not already absolute, prefix $HOME.
my $repo_base_abs = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$ENV{HOME}/$REPO_BASE" );
wrap_chdir("$repo_base_abs");
for my $repo (keys %repos)
{
unless (-d "$repo.git")
{
new_repo($repo, "$GL_ADMINDIR/src/hooks");
$git_too_old++ if $git_version < 10602; # that's 1.6.2 to you
# new_repo would have chdir'd us away; come back
wrap_chdir("$repo_base_abs");
}
}
warn "\n\t\t***** WARNING *****\n" .
"\tyour git version is older than 1.6.2\n" .
"\tgitolite will work but you MUST read the section on\n" .
"\t\"git version dependency\" in doc/3-faq-tips-etc.mkd\n"
if $git_too_old;
if $git_version < 10602; # that's 1.6.2 to you
# ----------------------------------------------------------------------------
# handle gitweb and daemon
@ -343,6 +328,10 @@ warn "\n\t\t***** WARNING *****\n" .
# :-) These are now "pseduo users" -- giving them "R" access to a repo is all
# you have to do
# repo-base needs to be an absolute path for this loop to work right
# so if it was not already absolute, prefix $HOME.
my $repo_base_abs = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$ENV{HOME}/$REPO_BASE" );
wrap_chdir("$repo_base_abs");
# daemons first...