From ed47d1aef89950f9eeb0f2497af0517e4ab8fc85 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Tue, 20 Mar 2012 09:13:05 +0530 Subject: [PATCH] two significant fixes to load: - don't look for user-roles if the repo is missing (doesn't make sense and because we roll in the = CREATOR function into that, it causes bugs like [1] below) - allow ^CREATOR/ in repo names (i.e., don't insist it has to be /CREATOR/) ---- [1] here's the bug repo foo/..* C = u1 RW+ = CREATOR # <--- this line R = READERS RW = WRITERS causes GL_USER=u2 gitolite info to print hello u2, this is gitolite3 (unknown) on git 1.7.7.6 R W foo/..* R W testing when in reality it should not be looking at CREATOR at all. --- src/Gitolite/Conf/Load.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Gitolite/Conf/Load.pm b/src/Gitolite/Conf/Load.pm index bf4dd0f..752da49 100644 --- a/src/Gitolite/Conf/Load.pm +++ b/src/Gitolite/Conf/Load.pm @@ -282,7 +282,7 @@ sub memberships { } } - if ( $type eq 'user' and $repo ) { + if ( $type eq 'user' and $repo and not repo_missing($repo) ) { # find the roles this user has when accessing this repo and add those # in as groupnames he is a member of. You need the already existing # memberships for this; see below this function for an example @@ -361,7 +361,9 @@ sub generic_name { # In particular, 'gitolite access' can't be used to check ^C perms. $creator = creator($base); - ( $base2 = $base ) =~ s(/$creator/)(/CREATOR/) if $creator; + $base2 = $base; + $base2 =~ s(/$creator/)(/CREATOR/) if $creator; + $base2 =~ s(^$creator/)(CREATOR/) if $creator; $base2 = '' if $base2 eq $base; # if there was no change return $base2;