]> Sergey Matveev's repositories - public-inbox.git/commitdiff
test_common: key test inboxes to init.defaultBranch
authorEric Wong <e@80x24.org>
Wed, 27 Oct 2021 04:07:54 +0000 (04:07 +0000)
committerEric Wong <e@80x24.org>
Wed, 27 Oct 2021 05:22:42 +0000 (05:22 +0000)
This lets users change their global init.defaultBranch config
knob in ~/.gitconfig or similar without breaking tests.

Reported-by: Thomas Weißschuh <thomas@t-8ch.de>
Tested-by: Thomas Weißschuh <thomas@t-8ch.de>
lib/PublicInbox/TestCommon.pm

index fb0d5a4e6ededaabcff6f78385b6e927fdac95bb..c3820d3a57463e44f19843541ec4003082a0874b 100644 (file)
@@ -674,8 +674,10 @@ sub create_inbox ($$;@) {
        my %opt = @_;
        require PublicInbox::Lock;
        require PublicInbox::InboxWritable;
+       require PublicInbox::Import;
        my ($base) = ($0 =~ m!\b([^/]+)\.[^\.]+\z!);
-       my $dir = "t/data-gen/$base.$ident";
+       my ($db) = (PublicInbox::Import::default_branch() =~ m!([^/]+)\z!);
+       my $dir = "t/data-gen/$base.$ident-$db";
        my $new = !-d $dir;
        if ($new) {
                mkdir $dir; # may race