]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: make remote_heads config setting work
authorPhil Pennock <redacted>
Mon, 5 Nov 2012 23:50:47 +0000 (18:50 -0500)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:32 +0000 (00:51 -0400)
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 <redacted>
Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 8d9e568de66c7c5b7cf1a6bfc007940fb00e286514eafef756d383cd9cb803c3..6c9d36c9dc87d2659c862da80c07a3a9cac69bd4c89a870c73a070d0aae85802 100755 (executable)
@@ -541,7 +541,7 @@ our %feature = (
        # $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,
@@ -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) {
This page took 0.419072 seconds and 4 git commands to generate.