]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Config.pm
config: use '-f' key to store config file pathname
[public-inbox.git] / lib / PublicInbox / Config.pm
index a4b1756da1b4934809553a3de3d4178864de0944..87a03fd378214aac91dad4b9e9741ebeb9cfb809 100644 (file)
@@ -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
@@ -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);