]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Config.pm
www_stream: add trailing slash for help and color links
[public-inbox.git] / lib / PublicInbox / Config.pm
index 21f2161a287bd2743eadbf76b1cb379731f41948..87a03fd378214aac91dad4b9e9741ebeb9cfb809 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2014-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 #
 # Used throughout the project for reading configuration
@@ -26,6 +26,7 @@ sub new {
                $self = config_fh_parse($fh, "\n", '=');
        } else {
                $self = git_config_dump($file);
+               $self->{'-f'} = $file;
        }
        bless $self, $class;
        # caches
@@ -496,7 +497,7 @@ EOF
 
 sub _fill_ei ($$) {
        my ($self, $pfx) = @_;
-       require PublicInbox::ExtSearch;
+       eval { require PublicInbox::ExtSearch } or return;
        my $d = $self->{"$pfx.topdir"};
        defined($d) && -d $d ? PublicInbox::ExtSearch->new($d) : undef;
 }
@@ -505,7 +506,7 @@ sub urlmatch {
        my ($self, $key, $url) = @_;
        state $urlmatch_broken; # requires git 1.8.5
        return if $urlmatch_broken;
-       my $file = default_file();
+       my $file = $self->{'-f'} // default_file();
        my $cmd = [qw/git config -z --includes --get-urlmatch/,
                "--file=$file", $key, $url ];
        my $fh = popen_rd($cmd);