PRE_ and POST_CREATE should work for normal repos also

This commit is contained in:
Sitaram Chamarty 2012-05-25 12:26:52 +05:30
parent 04367af3e8
commit 0f3a09ce60
3 changed files with 18 additions and 6 deletions

View file

@ -61,7 +61,7 @@ Triggers receive the following arguments:
Here are the **rest of** the arguments for each trigger, plus a brief
description of when the trigger runs:
* `ACCESS_1` runs after the first access check. Arguments:
* `ACCESS_1` runs after the first access check. Extra arguments:
* repo
* user
* 'R' or 'W'
@ -71,7 +71,7 @@ description of when the trigger runs:
result contains the refex that caused the access to succeed.
* `ACCESS_2` runs after the second access check, in the update hook.
Arguments:
Extra arguments:
* repo
* user
* any of W, +, C, D, WM, +M, CM, DM
@ -79,7 +79,7 @@ description of when the trigger runs:
* result (see above)
* `PRE_GIT` and `POST_GIT` run just before and after the git command.
Arguments:
Extra arguments:
* repo
* user
* 'R' or 'W'
@ -88,12 +88,16 @@ description of when the trigger runs:
'git-upload-archive') being invoked.
* `PRE_CREATE` and `POST_CREATE` run just before and after a new "[wild][]"
repo is created by user action. Arguments:
repo is created by user action. Extra arguments:
* repo
* user
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:
* repo
* `POST_COMPILE` runs after an admin push has successfully "compiled" the
config file. By default, the next thing is to update the ssh authkeys
file, then all the 'git-config's, gitweb access, and daemon access.
No arguments.
No extra arguments.

View file

@ -34,6 +34,10 @@ sub compile {
# place to put the individual gl-conf files
new_repos();
store();
for my $repo ( @{ $rc{NEW_REPOS_CREATED} } ) {
trigger( 'POST_CREATE', $repo );
}
}
sub parse {

View file

@ -164,7 +164,11 @@ sub new_repos {
# use gl-conf as a sentinel
hook_1($repo) if -d "$repo.git" and not -f "$repo.git/gl-conf";
new_repo($repo) if not -d "$repo.git";
if (not -d "$repo.git") {
push @{ $rc{NEW_REPOS_CREATED} }, $repo;
trigger( 'PRE_CREATE', $repo );
new_repo($repo);
}
}
}