diff options
author | Sitaram Chamarty <sitaramc@gmail.com> | 2019-12-22 20:52:00 +0530 |
---|---|---|
committer | Sitaram Chamarty <sitaramc@gmail.com> | 2019-12-22 20:52:00 +0530 |
commit | 1a2d8c9e26366b82c75960a58b37fc674b3b1aa5 (patch) | |
tree | ade556e27580c15e93287b5b472e0cee701924b9 | |
parent | finally added notes on how to test mirroring and http mode! (diff) | |
download | gitolite-gentoo-1a2d8c9e26366b82c75960a58b37fc674b3b1aa5.tar.gz gitolite-gentoo-1a2d8c9e26366b82c75960a58b37fc674b3b1aa5.tar.bz2 gitolite-gentoo-1a2d8c9e26366b82c75960a58b37fc674b3b1aa5.zip |
memberships: don't try to match patterns for users!
Technically, the previous behaviour could even be called a "feature", in
that it allowed you to use regexes for users -- contradicting the
documentation! -- in the following way:
@foo = u[123] u9
repo bar
RW+ = @foo
which would enable users u1, u2, and u3 to access bar.
I thought for a bit about this, and decided to fix the code rather than
the documentation.
Leaving it as a quirk was another alternative, but it would only be a
quirk [1], and an incomplete one at that because it only works for
patterns inside *groups*, not patterns that are actually *on* the rule
line (e.g. RW+ = u[123]). No good...
Thanks to Steven Peckins for catching this.
[1]:
$ dict quirk
From The Collaborative Fictional Dictionary of English v.0.48 [gcide]:
Quirk \Quirk\ (kw[~e]rk), n. [Written also {querk}.]
1. a bug that doesn't do enough harm to be shot down with extreme
prejudice, and in fact might even be said to do something
vaguely OK. If you squint. And if it's a Sunday.
-rw-r--r-- | src/lib/Gitolite/Conf/Load.pm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/Gitolite/Conf/Load.pm b/src/lib/Gitolite/Conf/Load.pm index d377bca..7dea259 100644 --- a/src/lib/Gitolite/Conf/Load.pm +++ b/src/lib/Gitolite/Conf/Load.pm @@ -396,9 +396,12 @@ sub memberships { push @ret, @{ $groups{$base} } if exists $groups{$base}; push @ret, @{ $groups{$base2} } if $base2 and exists $groups{$base2}; - for my $i ( keys %{ $patterns{groups} } ) { - if ( $base =~ /^$i$/ or $base2 and ( $base2 =~ /^$i$/ ) ) { - push @ret, @{ $groups{$i} }; + if ($type eq 'repo') { + # regexes can only be used for repos, not for users + for my $i ( keys %{ $patterns{groups} } ) { + if ( $base =~ /^$i$/ or $base2 and ( $base2 =~ /^$i$/ ) ) { + push @ret, @{ $groups{$i} }; + } } } |