Skip to content

Commit

Permalink
gitweb: make remote_heads config setting work
Browse files Browse the repository at this point in the history
Git configuration items can not contain underscores in their section
and bottom-level variable name; the 'remote_heads' feature can not
be enabled on a per-repository basis with that name.

This changes the git-config option to be `gitweb.remoteheads` but does
not change the gitweb.conf option, to avoid backwards compatibility
issues.  We strip underscores from keys before looking through
git-config output for them.

An existing check on keynames was overly eager to reject non-word
letters, but if we ever start using three-level names, the middle
level string can contain almost anything, so fix that as well while
we are in the vicinity.

Signed-off-by: Phil Pennock <phil@apcera.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Phil Pennock authored and Junio C Hamano committed Nov 21, 2012
1 parent f07e555 commit af50794
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ sub evaluate_uri {
# $feature{'remote_heads'}{'default'} = [1];
# To have project specific config enable override in $GITWEB_CONFIG
# $feature{'remote_heads'}{'override'} = 1;
# and in project config gitweb.remote_heads = 0|1;
# and in project config gitweb.remoteheads = 0|1;
'remote_heads' => {
'sub' => sub { feature_bool('remote_heads', @_) },
'override' => 0,
Expand Down Expand Up @@ -2697,12 +2697,15 @@ sub git_get_project_config {
# only subsection, if exists, is case sensitive,
# and not lowercased by 'git config -z -l'
if (my ($hi, $mi, $lo) = ($key =~ /^([^.]*)\.(.*)\.([^.]*)$/)) {
$lo =~ s/_//g;
$key = join(".", lc($hi), $mi, lc($lo));
return if ($lo =~ /\W/ || $hi =~ /\W/);
} else {
$key = lc($key);
$key =~ s/_//g;
return if ($key =~ /\W/);
}
$key =~ s/^gitweb\.//;
return if ($key =~ m/\W/);

# type sanity check
if (defined $type) {
Expand Down

0 comments on commit af50794

Please sign in to comment.