From 4f95d67d882eec0f058dd62ee83e8b9c973f4a26 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 25 Dec 2018 03:44:57 +0000 Subject: init: do not set publicinbox.$NAME.indexlevel by default It is redundant to set default values in the public-inbox config file. Lets not clutter up users' screens when they view or edit the config file. --- t/init.t | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 't') diff --git a/t/init.t b/t/init.t index 59f54813..182d065c 100644 --- a/t/init.t +++ b/t/init.t @@ -32,6 +32,8 @@ sub quiet_fail { qw(http://example.com/blist blist@example.com)); is(system(@cmd), 0, 'public-inbox-init OK'); + is(read_indexlevel('blist'), '', 'indexlevel unset by default'); + ok(-e $cfgfile, "config exists, now"); is(system(@cmd), 0, 'public-inbox-init OK (idempotent)'); @@ -64,10 +66,26 @@ SKIP: { is(system(@cmd), 0, 'public-inbox-init is idempotent'); ok(! -d "$tmpdir/public-inbox" && !-d "$tmpdir/objects", 'idempotent invocation w/o -V2 does not make inbox v1'); + is(read_indexlevel('v2list'), '', 'indexlevel unset by default'); @cmd = (pi_init, 'v2list', "-V1", "$tmpdir/v2list", qw(http://example.com/v2list v2list@example.com)); quiet_fail(\@cmd, 'initializing V2 as V1 fails'); + + foreach my $lvl (qw(medium basic)) { + @cmd = (pi_init, "v2$lvl", '-V2', '-L', $lvl, + "$tmpdir/v2$lvl", "http://example.com/v2$lvl", + "v2$lvl\@example.com"); + is(system(@cmd), 0, "-init -L $lvl"); + is(read_indexlevel("v2$lvl"), $lvl, "indexlevel set to '$lvl'"); + } } done_testing(); + +sub read_indexlevel { + my ($inbox) = @_; + local $ENV{GIT_CONFIG} = "$ENV{PI_DIR}/config"; + chomp(my $lvl = `git config publicinbox.$inbox.indexlevel`); + $lvl; +} -- cgit v1.2.3-24-ge0c7