update hook now allows chaining to "update.secondary"
the changes to cp/scp are because without "-p" they dont carry perms across to existing files. So if you forgot to chmod +x your custom hook and ran easy install, then after that you have to go to the server side to fix the perms...
This commit is contained in:
parent
bf7aba7e0b
commit
ed5c78349e
|
@ -10,6 +10,7 @@ In this document:
|
||||||
* moving pre-existing repos into gitolite
|
* moving pre-existing repos into gitolite
|
||||||
* specifying gitweb and daemon access
|
* specifying gitweb and daemon access
|
||||||
* custom hooks
|
* custom hooks
|
||||||
|
* when you need your own "update" hook
|
||||||
* custom git config
|
* custom git config
|
||||||
|
|
||||||
### administer
|
### administer
|
||||||
|
@ -112,6 +113,17 @@ implements all the branch-level permissions in gitolite. If you fiddle with
|
||||||
the hooks directory, please make sure you do not mess with this file
|
the hooks directory, please make sure you do not mess with this file
|
||||||
accidentally, or all your fancy per-branch permissions will stop working.**
|
accidentally, or all your fancy per-branch permissions will stop working.**
|
||||||
|
|
||||||
|
#### when you need your own "update" hook
|
||||||
|
|
||||||
|
Gitolite basically takes over the update hook for all repos, but some setups
|
||||||
|
really need the update hook functionality for their own purposes too. In
|
||||||
|
order to allow this, Gitolite now exec's a hook called `update.secondary` when
|
||||||
|
it's own "update" hook is done and everything is ready to go.
|
||||||
|
|
||||||
|
You can create this `update.secondary` hook selectively on some repos on the
|
||||||
|
server, or use the mechanism in the previous section to make gitolite install
|
||||||
|
it on *all* your repos.
|
||||||
|
|
||||||
#### custom git config
|
#### custom git config
|
||||||
|
|
||||||
The custom hooks feature is a blunt instrument -- all repos get the hook you
|
The custom hooks feature is a blunt instrument -- all repos get the hook you
|
||||||
|
|
|
@ -54,6 +54,8 @@ require "$ENV{GL_BINDIR}/gitolite.pm";
|
||||||
# start...
|
# start...
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
my @saved_ARGV = @ARGV; # for chaining to another update hook at the end
|
||||||
|
|
||||||
my $ref = shift;
|
my $ref = shift;
|
||||||
my $oldsha = shift;
|
my $oldsha = shift;
|
||||||
my $newsha = shift;
|
my $newsha = shift;
|
||||||
|
@ -110,4 +112,9 @@ my $log_refex = check_ref(\@allowed_refs, $ENV{GL_REPO}, (shift @refs), $perm);
|
||||||
&log_it("$ENV{GL_TS} $perm\t" .
|
&log_it("$ENV{GL_TS} $perm\t" .
|
||||||
substr($oldsha, 0, 14) . "\t" . substr($newsha, 0, 14) .
|
substr($oldsha, 0, 14) . "\t" . substr($newsha, 0, 14) .
|
||||||
"\t$reported_repo\t$ref\t$ENV{GL_USER}\t$log_refex\n");
|
"\t$reported_repo\t$ref\t$ENV{GL_USER}\t$log_refex\n");
|
||||||
|
|
||||||
|
# now chain to the local admin defined update hook, if present
|
||||||
|
exec "./hooks/update.secondary", @saved_ARGV
|
||||||
|
if -f "hooks/update.secondary" or -l "hooks/update.secondary";
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
|
@ -282,7 +282,7 @@ copy_gl() {
|
||||||
# have to create the directory first.
|
# have to create the directory first.
|
||||||
|
|
||||||
ssh -p $port $user@$host mkdir -p gitolite-install
|
ssh -p $port $user@$host mkdir -p gitolite-install
|
||||||
scp $quiet -P $port -r src conf doc hooks $user@$host:gitolite-install/
|
scp $quiet -P $port -p -r src conf doc hooks $user@$host:gitolite-install/
|
||||||
|
|
||||||
# MANUAL: now log on to the server (ssh git@server) and get a command
|
# MANUAL: now log on to the server (ssh git@server) and get a command
|
||||||
# line. This step is for your convenience; the script does it all from
|
# line. This step is for your convenience; the script does it all from
|
||||||
|
|
|
@ -59,10 +59,10 @@ for my $dir qw(conf doc keydir logs src hooks hooks/common hooks/gitolite-admin)
|
||||||
|
|
||||||
# "src" and "doc" will be overwritten on each install, but not conf
|
# "src" and "doc" will be overwritten on each install, but not conf
|
||||||
if ($GL_PACKAGE_HOOKS) {
|
if ($GL_PACKAGE_HOOKS) {
|
||||||
system("cp -R $GL_PACKAGE_HOOKS $GL_ADMINDIR");
|
system("cp -R -p $GL_PACKAGE_HOOKS $GL_ADMINDIR");
|
||||||
} else {
|
} else {
|
||||||
system("cp -R $bindir/../src $bindir/../doc $bindir/../hooks $GL_ADMINDIR");
|
system("cp -R -p $bindir/../src $bindir/../doc $bindir/../hooks $GL_ADMINDIR");
|
||||||
system("cp $bindir/../conf/VERSION $GL_ADMINDIR/conf");
|
system("cp $bindir/../conf/VERSION $GL_ADMINDIR/conf");
|
||||||
}
|
}
|
||||||
|
|
||||||
unless (-f $GL_CONF or $GL_PACKAGE_CONF) {
|
unless (-f $GL_CONF or $GL_PACKAGE_CONF) {
|
||||||
|
|
Loading…
Reference in a new issue