Skip to content
Browse files

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.
  • Loading branch information...
1 parent 57f82ee commit fbd745958e4c42d49d0fa3e82d3235c3129d50b4 @sitaramc committed
Showing with 13 additions and 9 deletions.
  1. +4 −0 doc/triggers.mkd
  2. +1 −1 src/commands/fork
  3. +3 −3 src/commands/perms
  4. +2 −2 src/gitolite-shell
  5. +3 −3 src/lib/Gitolite/Conf/Store.pm
View
4 doc/triggers.mkd
@@ -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:
View
2 src/commands/fork
@@ -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
View
6 src/commands/perms
@@ -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' );
# ----------------------------------------------------------------------
View
4 src/gitolite-shell
@@ -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
View
6 src/lib/Gitolite/Conf/Store.pm
@@ -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} );
}

0 comments on commit fbd7459

Please sign in to comment.
Something went wrong with that request. Please try again.