fix accumulation of 'config' (git config) lines
If a repo matches multiple patterns, 'config' lines were being picked up only from one of the 'repo' paras, instead of from all applicable ones.
This commit is contained in:
parent
4c1e4b2b1a
commit
0b68365860
|
@ -644,13 +644,18 @@ sub parse_acl
|
||||||
# the old "convenience copy" thing. Now on steroids :)
|
# the old "convenience copy" thing. Now on steroids :)
|
||||||
|
|
||||||
# note that when copying the @all entry, we retain the destination name as
|
# note that when copying the @all entry, we retain the destination name as
|
||||||
# @all; we dont change it to $repo or $gl_user
|
# @all; we dont change it to $repo or $gl_user. We need to maintain this
|
||||||
|
# distinction to be able to print the @/#/& prefixes in the report output
|
||||||
|
# (see doc/report-output.mkd)
|
||||||
for my $r ('@all', @repo_plus) {
|
for my $r ('@all', @repo_plus) {
|
||||||
my $dr = $repo; $dr = '@all' if $r eq '@all';
|
my $dr = $repo; $dr = '@all' if $r eq '@all';
|
||||||
$repos{$dr}{DELETE_IS_D} = 1 if $repos{$r}{DELETE_IS_D};
|
$repos{$dr}{DELETE_IS_D} = 1 if $repos{$r}{DELETE_IS_D};
|
||||||
$repos{$dr}{CREATE_IS_C} = 1 if $repos{$r}{CREATE_IS_C};
|
$repos{$dr}{CREATE_IS_C} = 1 if $repos{$r}{CREATE_IS_C};
|
||||||
$repos{$dr}{NAME_LIMITS} = 1 if $repos{$r}{NAME_LIMITS};
|
$repos{$dr}{NAME_LIMITS} = 1 if $repos{$r}{NAME_LIMITS};
|
||||||
$git_configs{$dr} = $git_configs{$r} if $git_configs{$r};
|
# this needs to copy the key-value pairs from RHS to LHS, not just
|
||||||
|
# assign RHS to LHS! However, we want to roll in '@all' configs also
|
||||||
|
# into the actual $repo; there's no need to preserve the distinction
|
||||||
|
map { $git_configs{$repo}{$_} = $git_configs{$r}{$_} } keys %{$git_configs{$r}} if $git_configs{$r};
|
||||||
|
|
||||||
for my $u ('@all', "$gl_user - wild", @user_plus, keys %perm_cats) {
|
for my $u ('@all', "$gl_user - wild", @user_plus, keys %perm_cats) {
|
||||||
my $du = $gl_user; $du = '@all' if $u eq '@all' or ($perm_cats{$u} || '') eq '@all';
|
my $du = $gl_user; $du = '@all' if $u eq '@all' or ($perm_cats{$u} || '') eq '@all';
|
||||||
|
|
|
@ -245,6 +245,11 @@ sub parse_conf_line
|
||||||
for my $repo (@{ $repos_p }) # each repo in the current stanza
|
for my $repo (@{ $repos_p }) # each repo in the current stanza
|
||||||
{
|
{
|
||||||
$git_configs{$repo}{$key} = $value;
|
$git_configs{$repo}{$key} = $value;
|
||||||
|
|
||||||
|
# force entry in %repos. Without this, a repo para with just a
|
||||||
|
# config line and no ACLs gets ignored in the output
|
||||||
|
$repos{$repo}{HAS_CONFIG} = 1;
|
||||||
|
|
||||||
# no problem if it's a plain repo (non-pattern, non-groupname)
|
# no problem if it's a plain repo (non-pattern, non-groupname)
|
||||||
# OR wild configs are allowed
|
# OR wild configs are allowed
|
||||||
unless ( ($repo =~ $REPONAME_PATT and $repo !~ /^@/) or $GL_GITCONFIG_WILD) {
|
unless ( ($repo =~ $REPONAME_PATT and $repo !~ /^@/) or $GL_GITCONFIG_WILD) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ do
|
||||||
name "update rc file to allow foo.*"
|
name "update rc file to allow foo.*"
|
||||||
catrc
|
catrc
|
||||||
cp ~/1 ~/junk
|
cp ~/1 ~/junk
|
||||||
perl -pi -e 's/GL_GITCONFIG_KEYS = ""/GL_GITCONFIG_KEYS = "foo\\\\..*"/' ~/junk
|
perl -pi -e 's/GL_GITCONFIG_KEYS = ""/GL_GITCONFIG_KEYS = "gl\\\\..* foo\\\\..*"/' ~/junk
|
||||||
cat ~/junk | runremote dd of=.gitolite.rc
|
cat ~/junk | runremote dd of=.gitolite.rc
|
||||||
catrc
|
catrc
|
||||||
expect "GL_GITCONFIG_KEYS.*foo"
|
expect "GL_GITCONFIG_KEYS.*foo"
|
||||||
|
@ -130,6 +130,41 @@ do
|
||||||
expect '^.foo'
|
expect '^.foo'
|
||||||
expect 'frob = nitz'
|
expect 'frob = nitz'
|
||||||
|
|
||||||
|
name "check cumulative configs"
|
||||||
|
echo "
|
||||||
|
repo @all
|
||||||
|
config gl.mirror.master = \"git@gc.com git@gh.net\"
|
||||||
|
|
||||||
|
@leads = u1 u2
|
||||||
|
@devs = u1 u2 u3 u4
|
||||||
|
|
||||||
|
@gbar = bar/..*
|
||||||
|
repo @gbar
|
||||||
|
C = @leads
|
||||||
|
RW+ = CREATOR
|
||||||
|
RW = @leads
|
||||||
|
config foo.frob = nitz
|
||||||
|
|
||||||
|
repo b../tr.*
|
||||||
|
config foo.nitz = ham
|
||||||
|
" | ugc -r
|
||||||
|
expect_push_ok "master -> master"
|
||||||
|
|
||||||
|
name "check try1 has foo.frob"
|
||||||
|
runremote cat $TEST_BASE/bar/try1.git/config
|
||||||
|
expect '^.foo'
|
||||||
|
expect 'frob = nitz'
|
||||||
|
|
||||||
|
name "check try1 has foo.nitz"
|
||||||
|
runremote cat $TEST_BASE/bar/try2.git/config
|
||||||
|
expect '^.foo'
|
||||||
|
expect 'nitz = ham'
|
||||||
|
|
||||||
|
name "check @all config works..."
|
||||||
|
runremote cat $TEST_BASE/bar/try2.git/config
|
||||||
|
expect gl.\"mirror\"
|
||||||
|
expect master = .git.gc.com git.gh.net
|
||||||
|
|
||||||
name INTERNAL
|
name INTERNAL
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue