Skip to content

Commit af50794

Browse files
Phil Pennockgitster
authored andcommitted
gitweb: make remote_heads config setting work
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 <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f07e555 commit af50794

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gitweb/gitweb.perl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ sub evaluate_uri {
541541
# $feature{'remote_heads'}{'default'} = [1];
542542
# To have project specific config enable override in $GITWEB_CONFIG
543543
# $feature{'remote_heads'}{'override'} = 1;
544-
# and in project config gitweb.remote_heads = 0|1;
544+
# and in project config gitweb.remoteheads = 0|1;
545545
'remote_heads' => {
546546
'sub' => sub { feature_bool('remote_heads', @_) },
547547
'override' => 0,
@@ -2697,12 +2697,15 @@ sub git_get_project_config {
26972697
# only subsection, if exists, is case sensitive,
26982698
# and not lowercased by 'git config -z -l'
26992699
if (my ($hi, $mi, $lo) = ($key =~ /^([^.]*)\.(.*)\.([^.]*)$/)) {
2700+
$lo =~ s/_//g;
27002701
$key = join(".", lc($hi), $mi, lc($lo));
2702+
return if ($lo =~ /\W/ || $hi =~ /\W/);
27012703
} else {
27022704
$key = lc($key);
2705+
$key =~ s/_//g;
2706+
return if ($key =~ /\W/);
27032707
}
27042708
$key =~ s/^gitweb\.//;
2705-
return if ($key =~ m/\W/);
27062709

27072710
# type sanity check
27082711
if (defined $type) {

0 commit comments

Comments
 (0)