Make limit on number of repos displayed by info with GL_BIG_CONFIG configurable

[doc added by Sitaram]
This commit is contained in:
Dylan Simon 2011-03-23 21:45:35 -04:00 committed by Sitaram Chamarty
parent 0f377a7679
commit 58064b8e20
5 changed files with 22 additions and 6 deletions

View file

@ -35,6 +35,7 @@ $REPO_UMASK = 0077;
$GL_BIG_CONFIG = 0; $GL_BIG_CONFIG = 0;
$GL_NO_DAEMON_NO_GITWEB = 0; $GL_NO_DAEMON_NO_GITWEB = 0;
# $GL_NICE_VALUE = 0; # $GL_NICE_VALUE = 0;
# $BIG_INFO_CAP = 20;
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# VARIABLES WITH A SECURITY IMPACT. READ DOCS BEFORE CHANGING THESE! # VARIABLES WITH A SECURITY IMPACT. READ DOCS BEFORE CHANGING THESE!

View file

@ -86,6 +86,10 @@ things happen if you change them.
Please do NOT set it if your bits/resource.h does not define PRIO_PROCESS Please do NOT set it if your bits/resource.h does not define PRIO_PROCESS
is 0. For Linux this is true... is 0. For Linux this is true...
* `$BIG_INFO_CAP`, number, default 20
See [using patterns to limit output][limit] for details.
<a name="_variables_with_a_security_impact"></a> <a name="_variables_with_a_security_impact"></a>
### variables with a security impact ### variables with a security impact
@ -366,3 +370,4 @@ of `ADC_CMD_ARGS_PATT`), please be sure you know what you're doing.
[mob]: http://sitaramc.github.com/gitolite/doc/mob-branches.html [mob]: http://sitaramc.github.com/gitolite/doc/mob-branches.html
[smart]: http://sitaramc.github.com/gitolite/doc/http-backend.html [smart]: http://sitaramc.github.com/gitolite/doc/http-backend.html
[dwr]: http://sitaramc.github.com/gitolite/doc/3-faq-tips-etc.html#_disabling_write_access_to_take_backups [dwr]: http://sitaramc.github.com/gitolite/doc/3-faq-tips-etc.html#_disabling_write_access_to_take_backups
[limit]: http://sitaramc.github.com/gitolite/doc/report-output.html#_using_patterns_to_limit_output

View file

@ -98,7 +98,10 @@ Here are a couple of samples with optional patterns:
In "big-config" mode (i.e., when `GL_BIG_CONFIG` is set) the pattern is In "big-config" mode (i.e., when `GL_BIG_CONFIG` is set) the pattern is
**mandatory**. You can try and cheat the system by passing in a "." but **mandatory**. You can try and cheat the system by passing in a "." but
gitolite truncates the output after 20 results to prevent a DOS. gitolite truncates the output after 20 results to prevent a DOS. (This limit
can be changed; see `$BIG_INFO_CAP` in [doc/gitolite.rc.mkd][rcdoc]).
[rcdoc]: http://sitaramc.github.com/gitolite/doc/gitolite.rc.html
The pattern is also mandatory when an admin wants to find out what access some The pattern is also mandatory when an admin wants to find out what access some
*other* user has, which you may have guessed from the syntax in the "usage" *other* user has, which you may have guessed from the syntax in the "usage"
@ -141,3 +144,6 @@ account extra permissions enabled by the `setperms` command (see
doc/wildcard-repositories.mkd). It shows you the "creator" of the repo as doc/wildcard-repositories.mkd). It shows you the "creator" of the repo as
an additional column, defaulting to `<gitolite>` if it was not a wildcard an additional column, defaulting to `<gitolite>` if it was not a wildcard
repo. repo.
The limit of number of repos shown in big-config mode (20, by default)
described earlier applies to the "expand" command also.

View file

@ -524,8 +524,8 @@ sub report_basic
my $count = 0; my $count = 0;
for my $r (sort keys %repos) { for my $r (sort keys %repos) {
next unless $r =~ /$repo/i; next unless $r =~ /$repo/i;
# if $GL_BIG_CONFIG is on, limit the number of output lines to 20 # if $GL_BIG_CONFIG is on, limit the number of output lines
next if $GL_BIG_CONFIG and $count++ >= 20; next if $GL_BIG_CONFIG and $count++ >= $BIG_INFO_CAP;
if ($r =~ $REPONAME_PATT and $r !~ /\bCREAT[EO]R\b/) { if ($r =~ $REPONAME_PATT and $r !~ /\bCREAT[EO]R\b/) {
parse_acl($r, "NOBODY"); parse_acl($r, "NOBODY");
} else { } else {
@ -541,7 +541,7 @@ sub report_basic
$perm .= perm_code( $repos{$r}{W}{'@all'}, $repos{'@all'}{W}{$user}, $repos{$r}{W}{$user}, 'W'); $perm .= perm_code( $repos{$r}{W}{'@all'}, $repos{'@all'}{W}{$user}, $repos{$r}{W}{$user}, 'W');
print "$perm\t$r\r\n" if $perm =~ /\S/; print "$perm\t$r\r\n" if $perm =~ /\S/;
} }
print "only 20 out of $count candidate repos examined\r\nplease use a partial reponame or regex pattern to limit output\r\n" if $GL_BIG_CONFIG and $count > 20; print "only $BIG_INFO_CAP out of $count candidate repos examined\r\nplease use a partial reponame or regex pattern to limit output\r\n" if $GL_BIG_CONFIG and $count > $BIG_INFO_CAP;
print "$GL_SITE_INFO\n" if $GL_SITE_INFO; print "$GL_SITE_INFO\n" if $GL_SITE_INFO;
} }
@ -570,13 +570,13 @@ sub expand_wild
$actual_repo =~ s/\.git$//; $actual_repo =~ s/\.git$//;
# actual_repo has to match the pattern being expanded # actual_repo has to match the pattern being expanded
next unless $actual_repo =~ /$repo/i; next unless $actual_repo =~ /$repo/i;
next if $GL_BIG_CONFIG and $count++ >= 20; next if $GL_BIG_CONFIG and $count++ >= $BIG_INFO_CAP;
my($perm, $creator, $wild) = repo_rights($actual_repo); my($perm, $creator, $wild) = repo_rights($actual_repo);
next unless $perm =~ /\S/; next unless $perm =~ /\S/;
print "$perm\t$creator\t$actual_repo\n"; print "$perm\t$creator\t$actual_repo\n";
} }
print "only 20 out of $count candidate repos examined\nplease use a partial reponame or regex pattern to limit output\n" if $GL_BIG_CONFIG and $count > 20; print "only $BIG_INFO_CAP out of $count candidate repos examined\nplease use a partial reponame or regex pattern to limit output\n" if $GL_BIG_CONFIG and $count > $BIG_INFO_CAP;
print "$GL_SITE_INFO\n" if $GL_SITE_INFO; print "$GL_SITE_INFO\n" if $GL_SITE_INFO;
} }

View file

@ -11,6 +11,7 @@ use Exporter 'import';
$R_COMMANDS $W_COMMANDS $R_COMMANDS $W_COMMANDS
$REPONAME_PATT $USERNAME_PATT $REPOPATT_PATT $REPONAME_PATT $USERNAME_PATT $REPOPATT_PATT
$ADC_CMD_ARGS_PATT $ADC_CMD_ARGS_PATT
$BIG_INFO_CAP
$current_data_version $current_data_version
$ADMIN_POST_UPDATE_CHAINS_TO $ENV $GITOLITE_BASE $GITOLITE_PATH $GIT_PATH $ADMIN_POST_UPDATE_CHAINS_TO $ENV $GITOLITE_BASE $GITOLITE_PATH $GIT_PATH
@ -50,6 +51,9 @@ $REPOPATT_PATT=qr(^\@?[0-9a-zA-Z[][\\^.$|()[\]*+?{}0-9a-zA-Z._\@/-]*$);
# ADC commands and arguments must match this pattern # ADC commands and arguments must match this pattern
$ADC_CMD_ARGS_PATT=qr(^[0-9a-zA-Z._\@/+:-]*$); $ADC_CMD_ARGS_PATT=qr(^[0-9a-zA-Z._\@/+:-]*$);
# maximum number of output lines from info under GL_BIG_CONFIG
$BIG_INFO_CAP = 20;
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# bring in the rc vars and allow querying them # bring in the rc vars and allow querying them
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------