auto-create repo on 'C' perm done
This commit is contained in:
parent
a014d2ffd5
commit
89a1857d56
|
@ -7,6 +7,7 @@ package Gitolite::Conf::Load;
|
|||
load
|
||||
access
|
||||
git_config
|
||||
repo_missing
|
||||
vrefs
|
||||
lister_dispatch
|
||||
);
|
||||
|
@ -128,6 +129,11 @@ sub git_config {
|
|||
return \%ret;
|
||||
}
|
||||
|
||||
sub repo_missing {
|
||||
my $repo = shift;
|
||||
return not -d "$rc{GL_REPO_BASE}/$repo.git";
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
sub load_common {
|
||||
|
@ -158,6 +164,10 @@ sub load_1 {
|
|||
return if $repo =~ /^\@/;
|
||||
trace( 3, $repo );
|
||||
|
||||
if ( repo_missing($repo) ) {
|
||||
trace( 3, "repo '$repo' missing" );
|
||||
return;
|
||||
}
|
||||
_chdir("$rc{GL_REPO_BASE}/$repo.git");
|
||||
|
||||
if ( $repo eq $last_repo ) {
|
||||
|
@ -253,7 +263,6 @@ sub memberships {
|
|||
}
|
||||
|
||||
@ret = @{ sort_u( \@ret ) };
|
||||
dbg(\@ret);
|
||||
return @ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ package Gitolite::Conf::Store;
|
|||
expand_list
|
||||
new_repos
|
||||
new_repo
|
||||
new_wild_repo
|
||||
hook_repos
|
||||
store
|
||||
parse_done
|
||||
|
@ -194,6 +195,17 @@ sub new_repo {
|
|||
# XXX ignoring gl-post-init for now
|
||||
}
|
||||
|
||||
sub new_wild_repo {
|
||||
my ( $repo, $user ) = @_;
|
||||
_chdir( $rc{GL_REPO_BASE} );
|
||||
new_repo($repo);
|
||||
_print( "$repo.git/gl-creator", $user );
|
||||
# XXX _print("$repo.git/gl-perms", "$rc{WILDREPOS_DEFAULT_PERMS}\n") if $rc{WILDREPOS_DEFAULT_PERMS};
|
||||
# XXX git config, daemon, web...
|
||||
# XXX pre-create, post-create
|
||||
_chdir( $rc{GL_ADMIN_BASE} );
|
||||
}
|
||||
|
||||
sub hook_repos {
|
||||
trace(3);
|
||||
# all repos, all hooks
|
||||
|
|
|
@ -61,6 +61,13 @@ sub main {
|
|||
$ENV{GL_REPO} = $repo;
|
||||
my $aa = ( $verb =~ 'upload' ? 'R' : 'W' );
|
||||
|
||||
# auto-create?
|
||||
if ( repo_missing($repo) and access( $repo, $user, '^C', 'any' ) !~ /DENIED/ ) {
|
||||
require Gitolite::Conf::Store;
|
||||
Gitolite::Conf::Store->import;
|
||||
new_wild_repo( $repo, $user );
|
||||
}
|
||||
|
||||
# a ref of 'any' signifies that this is a pre-git check, where we don't
|
||||
# yet know the ref that will be eventually pushed (and even that won't
|
||||
# apply if it's a read operation). See the matching code in access() for
|
||||
|
|
Loading…
Reference in a new issue