move %GL_REPO and %GL_CREATOR substitution into core
see usage example at the end of src/triggers/upstream
This commit is contained in:
parent
be61cd2d66
commit
a509b208e3
|
@ -164,6 +164,14 @@ sub git_config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my($k, $v);
|
||||||
|
my $creator = creator($repo);
|
||||||
|
while (($k, $v) = each %ret) {
|
||||||
|
$v =~ s/%GL_REPO/$repo/g;
|
||||||
|
$v =~ s/%GL_CREATOR/$creator/g if $creator;
|
||||||
|
$ret{$k} = $v;
|
||||||
|
}
|
||||||
|
|
||||||
trace( 3, map { ( "$_" => "-> $ret{$_}" ) } ( sort keys %ret ) );
|
trace( 3, map { ( "$_" => "-> $ret{$_}" ) } ( sort keys %ret ) );
|
||||||
return \%ret;
|
return \%ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,6 @@ sub fixup_config {
|
||||||
while ( my ( $key, $value ) = each( %{$gc} ) ) {
|
while ( my ( $key, $value ) = each( %{$gc} ) ) {
|
||||||
next if $key =~ /^gitolite-options\./;
|
next if $key =~ /^gitolite-options\./;
|
||||||
if ( $value ne "" ) {
|
if ( $value ne "" ) {
|
||||||
$value =~ s/%GL_REPO/$pr/g;
|
|
||||||
$value =~ s/%GL_CREATOR/$creator/g if $creator;
|
|
||||||
system( "git", "config", "--file", "$RB/$pr.git/config", $key, $value );
|
system( "git", "config", "--file", "$RB/$pr.git/config", $key, $value );
|
||||||
} else {
|
} else {
|
||||||
system( "git", "config", "--file", "$RB/$pr.git/config", "--unset-all", $key );
|
system( "git", "config", "--file", "$RB/$pr.git/config", "--unset-all", $key );
|
||||||
|
|
|
@ -44,3 +44,29 @@ git fetch -q "$url" '+refs/*:refs/*'
|
||||||
# * if the upstream URL changes, just change the conf and push admin repo
|
# * if the upstream URL changes, just change the conf and push admin repo
|
||||||
# * the 'nice' setting is in minutes and is optional; it is the minimum
|
# * the 'nice' setting is in minutes and is optional; it is the minimum
|
||||||
# elapsed time between 2 upstream fetches.
|
# elapsed time between 2 upstream fetches.
|
||||||
|
|
||||||
|
# USAGE EXAMPLE:
|
||||||
|
#
|
||||||
|
# Let's say you want to keep a read-only local mirror of all your github repos
|
||||||
|
# on your local gitolite installation. Assuming your github usernames are the
|
||||||
|
# same as your local usernames, and you have updated GIT_CONFIG_KEYS in the rc
|
||||||
|
# file to allow 'config' lines, you can do this:
|
||||||
|
#
|
||||||
|
# repo github/CREATOR/..*
|
||||||
|
# C = @all
|
||||||
|
# R = @all
|
||||||
|
# option upstream.url = git://github.com/%GL_REPO.git
|
||||||
|
# option upstream.nice = 120
|
||||||
|
# config url.git://github.com/.insteadOf = git://github.com/github/
|
||||||
|
#
|
||||||
|
# Now you can make local, read-only, clones of all your github repos with
|
||||||
|
#
|
||||||
|
# git ls-remote gitolite:github/sitaramc/gitolite
|
||||||
|
# git ls-remote gitolite:github/sitaramc/hap
|
||||||
|
# (etc)
|
||||||
|
#
|
||||||
|
# and if milki were also a user on this gitolite instance, then
|
||||||
|
#
|
||||||
|
# git ls-remote gitolite:github/milki/xclip
|
||||||
|
# git ls-remote gitolite:github/milki/ircblogger
|
||||||
|
# (etc)
|
||||||
|
|
Loading…
Reference in a new issue