PRE_ and POST_CREATE triggers get an extra argument...
...when invoked by single-repo operations like auto-creating a wild repo, or running perms or fork.
This commit is contained in:
parent
57f82ee044
commit
fbd745958e
|
@ -138,6 +138,10 @@ description of when the trigger runs:
|
|||
repo is created by user action. Extra arguments:
|
||||
* repo
|
||||
* user
|
||||
* invoking operation
|
||||
* 'R' for fetch/clone/ls-remote, 'W' for push
|
||||
* can also be anything set by the external command running the
|
||||
trigger (e.g., see the perms and fork commands).
|
||||
|
||||
They are also run when a *normal* repo is created (say by adding a "repo
|
||||
foo" line to the conf file). This case has only one extra argument:
|
||||
|
|
|
@ -59,4 +59,4 @@ ln -sf `gitolite query-rc GL_ADMIN_BASE`/hooks/common/* hooks
|
|||
echo "$from" > gl-forked-from
|
||||
|
||||
# trigger post_create
|
||||
gitolite trigger POST_CREATE $to $GL_USER
|
||||
gitolite trigger POST_CREATE $to $GL_USER fork
|
||||
|
|
|
@ -55,14 +55,14 @@ if ( $ARGV[0] eq '-c' ) {
|
|||
|
||||
require Gitolite::Conf::Store;
|
||||
Gitolite::Conf::Store->import;
|
||||
new_wild_repo( $repo, $ENV{GL_USER} );
|
||||
gl_log( 'create', $repo, $ENV{GL_USER} );
|
||||
new_wild_repo( $repo, $ENV{GL_USER}, 'perms-c' );
|
||||
gl_log( 'create', $repo, $ENV{GL_USER}, 'perms-c' );
|
||||
}
|
||||
}
|
||||
|
||||
my $repo = shift;
|
||||
setperms(@ARGV);
|
||||
_system( "gitolite", "trigger", "POST_CREATE", $repo, $ENV{GL_USER} );
|
||||
_system( "gitolite", "trigger", "POST_CREATE", $repo, $ENV{GL_USER}, 'perms' );
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -107,8 +107,8 @@ sub main {
|
|||
if ( repo_missing($repo) and access( $repo, $user, '^C', 'any' ) !~ /DENIED/ ) {
|
||||
require Gitolite::Conf::Store;
|
||||
Gitolite::Conf::Store->import;
|
||||
new_wild_repo( $repo, $user );
|
||||
gl_log( 'create', $repo, $user );
|
||||
new_wild_repo( $repo, $user, $aa );
|
||||
gl_log( 'create', $repo, $user, $aa );
|
||||
}
|
||||
|
||||
# a ref of 'any' signifies that this is a pre-git check, where we don't
|
||||
|
|
|
@ -184,14 +184,14 @@ sub new_repo {
|
|||
}
|
||||
|
||||
sub new_wild_repo {
|
||||
my ( $repo, $user ) = @_;
|
||||
my ( $repo, $user, $aa ) = @_;
|
||||
_chdir( $rc{GL_REPO_BASE} );
|
||||
|
||||
trigger( 'PRE_CREATE', $repo, $user );
|
||||
trigger( 'PRE_CREATE', $repo, $user, $aa );
|
||||
new_repo($repo);
|
||||
_print( "$repo.git/gl-creator", $user );
|
||||
_print( "$repo.git/gl-perms", "$rc{DEFAULT_ROLE_PERMS}\n" ) if $rc{DEFAULT_ROLE_PERMS};
|
||||
trigger( 'POST_CREATE', $repo, $user );
|
||||
trigger( 'POST_CREATE', $repo, $user, $aa );
|
||||
|
||||
_chdir( $rc{GL_ADMIN_BASE} );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue