From 44723a3a3343a6b7a923d33da2bdac0c81bdc5f6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 9 Apr 2014 19:32:18 +0000 Subject: config: include listname on lookup We will be using it when setting GIT_COMMITTER_NAME --- lib/PublicInbox/Config.pm | 3 +++ t/config.t | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index b6885a31..300dd88b 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -35,6 +35,9 @@ sub lookup { my %rv = map { $_ => $self->{"$pfx.$_"} } (qw(mainrepo description address)); + my $listname = $pfx; + $listname =~ s/\Apublicinbox\.//; + $rv{listname} = $listname; \%rv; } diff --git a/t/config.t b/t/config.t index 145589ea..44e051f2 100644 --- a/t/config.t +++ b/t/config.t @@ -28,7 +28,8 @@ my $tmpdir = tempdir(CLEANUP => 1); is_deeply($cfg->lookup('bugs@public-inbox.org'), { 'mainrepo' => '/home/pi/bugs-main.git', 'address' => 'bugs@public-inbox.org', - 'description' => 'development discussion' + 'description' => 'development discussion', + 'listname' => 'bugs', }, "lookup matches expected output"); is($cfg->lookup('blah@example.com'), undef, -- cgit v1.2.3-24-ge0c7