From 58064b8e207f99e22963c1a534c3fb1c9a1de327 Mon Sep 17 00:00:00 2001 From: Dylan Simon Date: Wed, 23 Mar 2011 21:45:35 -0400 Subject: [PATCH] Make limit on number of repos displayed by info with GL_BIG_CONFIG configurable [doc added by Sitaram] --- conf/example.gitolite.rc | 1 + doc/gitolite.rc.mkd | 5 +++++ doc/report-output.mkd | 8 +++++++- src/gitolite.pm | 10 +++++----- src/gitolite_rc.pm | 4 ++++ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/conf/example.gitolite.rc b/conf/example.gitolite.rc index d800357..29272dc 100644 --- a/conf/example.gitolite.rc +++ b/conf/example.gitolite.rc @@ -35,6 +35,7 @@ $REPO_UMASK = 0077; $GL_BIG_CONFIG = 0; $GL_NO_DAEMON_NO_GITWEB = 0; # $GL_NICE_VALUE = 0; +# $BIG_INFO_CAP = 20; # ------------------------------------------------------------------------------ # VARIABLES WITH A SECURITY IMPACT. READ DOCS BEFORE CHANGING THESE! diff --git a/doc/gitolite.rc.mkd b/doc/gitolite.rc.mkd index 47fcd50..180535c 100644 --- a/doc/gitolite.rc.mkd +++ b/doc/gitolite.rc.mkd @@ -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 is 0. For Linux this is true... + * `$BIG_INFO_CAP`, number, default 20 + + See [using patterns to limit output][limit] for details. + ### 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 [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 +[limit]: http://sitaramc.github.com/gitolite/doc/report-output.html#_using_patterns_to_limit_output diff --git a/doc/report-output.mkd b/doc/report-output.mkd index a876b61..4f91579 100644 --- a/doc/report-output.mkd +++ b/doc/report-output.mkd @@ -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 **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 *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 an additional column, defaulting to `` if it was not a wildcard repo. + +The limit of number of repos shown in big-config mode (20, by default) +described earlier applies to the "expand" command also. diff --git a/src/gitolite.pm b/src/gitolite.pm index 9d636bd..1f75a35 100644 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@ -524,8 +524,8 @@ sub report_basic my $count = 0; for my $r (sort keys %repos) { next unless $r =~ /$repo/i; - # if $GL_BIG_CONFIG is on, limit the number of output lines to 20 - next if $GL_BIG_CONFIG and $count++ >= 20; + # if $GL_BIG_CONFIG is on, limit the number of output lines + next if $GL_BIG_CONFIG and $count++ >= $BIG_INFO_CAP; if ($r =~ $REPONAME_PATT and $r !~ /\bCREAT[EO]R\b/) { parse_acl($r, "NOBODY"); } else { @@ -541,7 +541,7 @@ sub report_basic $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 "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; } @@ -570,13 +570,13 @@ sub expand_wild $actual_repo =~ s/\.git$//; # actual_repo has to match the pattern being expanded 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); next unless $perm =~ /\S/; 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; } diff --git a/src/gitolite_rc.pm b/src/gitolite_rc.pm index cb7e674..f4bdd37 100644 --- a/src/gitolite_rc.pm +++ b/src/gitolite_rc.pm @@ -11,6 +11,7 @@ use Exporter 'import'; $R_COMMANDS $W_COMMANDS $REPONAME_PATT $USERNAME_PATT $REPOPATT_PATT $ADC_CMD_ARGS_PATT + $BIG_INFO_CAP $current_data_version $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_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 # ------------------------------------------------------------------------------