aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Gitolite/Conf')
-rw-r--r--src/lib/Gitolite/Conf/Load.pm24
-rw-r--r--src/lib/Gitolite/Conf/Store.pm5
-rw-r--r--src/lib/Gitolite/Conf/Sugar.pm17
3 files changed, 38 insertions, 8 deletions
diff --git a/src/lib/Gitolite/Conf/Load.pm b/src/lib/Gitolite/Conf/Load.pm
index 15b1d03..a439fc8 100644
--- a/src/lib/Gitolite/Conf/Load.pm
+++ b/src/lib/Gitolite/Conf/Load.pm
@@ -348,7 +348,7 @@ sub load_1 {
return if not $split_conf{$repo};
my $cc = "./gl-conf";
- _die "parse '$cc' failed: " . ( $! or $@ ) unless do $cc;
+ _die "parse '$cc' failed: " . ( $@ or $! ) unless do $cc;
$last_repo = $repo;
$repos{$repo} = $one_repo{$repo};
@@ -583,15 +583,24 @@ sub list_groups {
=for list_users
Usage: gitolite list-users [<repo name pattern>]
-List all users and groups explicitly named in a rule. User names not
-mentioned in an access rule will not show up; you have to run 'list-members'
-on each group name yourself to see them.
+List all users and groups explicitly named in a rule.
+
+- you will have to run 'list-members' on each group name to expand it -- for
+ details and caveats on that please see its help message.
+- User names not mentioned in an access rule will not show up at all (for
+ example, if you have users who only have access via an '@all' rule).
WARNING: may be slow if you have thousands of repos. The optional repo name
pattern is an unanchored regex; it can speed things up if you're interested
only in users of a matching set of repos. This is only an optimisation, not
an actual access list; you will still have to pipe it to 'gitolite access'
with appropriate arguments to get an actual access list.
+
+NOTE: If you're running in ssh mode, it may be simpler to parse the authorized
+keys file in ~/.ssh, like so:
+ perl -lne '/ ([a-z0-9]+)"/; print $1 if $1' < ~/.ssh/authorized_keys | sort -u
+If you're running in http mode, only your web server knows all the potential
+user names.
=cut
sub list_users {
@@ -677,6 +686,13 @@ Usage: gitolite list-members <group name>
- list all members of a group
- takes one group name
+
+'@all' is not expandable in this context. Also, if you have GROUPLIST_PGM set
+in your rc file[1], gitolite cannot expand group names completely; only your
+external database can.
+
+[1]: http://gitolite.com/gitolite/conf.html#ldap
+
=cut
sub list_members {
diff --git a/src/lib/Gitolite/Conf/Store.pm b/src/lib/Gitolite/Conf/Store.pm
index 5568b3f..c7f9ab5 100644
--- a/src/lib/Gitolite/Conf/Store.pm
+++ b/src/lib/Gitolite/Conf/Store.pm
@@ -288,8 +288,6 @@ sub store_1 {
my ( %one_repo, %one_config );
- open( my $compiled_fh, ">", "$repo.git/gl-conf" ) or return;
-
my $dumped_data = '';
if ( $repos{$repo} ) {
$one_repo{$repo} = $repos{$repo};
@@ -303,8 +301,7 @@ sub store_1 {
$dumped_data .= Data::Dumper->Dump( [ \%one_config ], [qw(*one_config)] );
}
- print $compiled_fh $dumped_data;
- close $compiled_fh;
+ _print( "$repo.git/gl-conf", $dumped_data );
$split_conf{$repo} = 1;
}
diff --git a/src/lib/Gitolite/Conf/Sugar.pm b/src/lib/Gitolite/Conf/Sugar.pm
index 986494b..68ad728 100644
--- a/src/lib/Gitolite/Conf/Sugar.pm
+++ b/src/lib/Gitolite/Conf/Sugar.pm
@@ -68,6 +68,7 @@ sub sugar {
$lines = owner_desc($lines);
$lines = name_vref($lines);
$lines = role_names($lines);
+ $lines = skip_block($lines);
return $lines;
}
@@ -179,5 +180,21 @@ sub role_names {
return \@ret;
}
+sub skip_block {
+ my $lines = shift;
+
+ my @out = ();
+ for (@$lines) {
+ my $skip = 0;
+ $skip = 1 if /^= *begin testconf$/;
+ # add code for other types of blocks here as needed
+
+ next if $skip .. /^= *end$/;
+ push @out, $_;
+ }
+
+ return \@out;
+}
+
1;