about summary refs log tree commit homepage
path: root/t/gcf2_client.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-09-19 09:37:13 +0000
committerEric Wong <e@80x24.org>2020-09-19 21:39:46 +0000
commit881a5493a8c970c10c051cc55d10d2968e71e691 (patch)
tree2ad0e7a2658ae855b4c1a5bae663633dfca01098 /t/gcf2_client.t
parent3750b2e2952e55fe4a04c73fc78f25c5e07d0525 (diff)
downloadpublic-inbox-881a5493a8c970c10c051cc55d10d2968e71e691.tar.gz
This amortizes the cost of recreating PublicInbox::Gcf2 objects
when alternates change in v2 all.git.
Diffstat (limited to 't/gcf2_client.t')
-rw-r--r--t/gcf2_client.t11
1 files changed, 4 insertions, 7 deletions
diff --git a/t/gcf2_client.t b/t/gcf2_client.t
index 0f7e7203..19462379 100644
--- a/t/gcf2_client.t
+++ b/t/gcf2_client.t
@@ -27,9 +27,7 @@ my $err_f = "$tmpdir/err";
         local $ENV{PATH} = getcwd()."/blib/script:$ENV{PATH}";
         open my $err, '>', $err_f or BAIL_OUT $!;
         my $gcf2c = PublicInbox::Gcf2Client::new({ 2 => $err });
-        $gcf2c->add_git_dir($git_a);
-
-        $gcf2c->cat_async($tree, sub {
+        $gcf2c->cat_async("$tree $git_a", sub {
                 my ($bref, $oid, $type, $size, $arg) = @_;
                 is($oid, $tree, 'got expected OID');
                 is($size, 30, 'got expected length');
@@ -45,7 +43,7 @@ my $err_f = "$tmpdir/err";
         is($estr, '', 'nothing in stderr');
 
         my $trunc = substr($tree, 0, 39);
-        $gcf2c->cat_async($trunc, sub {
+        $gcf2c->cat_async("$trunc $git_a", sub {
                 my ($bref, $oid, $type, $size, $arg) = @_;
                 is(undef, $bref, 'missing bref is undef');
                 is($oid, $trunc, 'truncated OID printed');
@@ -63,8 +61,7 @@ my $err_f = "$tmpdir/err";
         # try failed alternates lookup
         open $err, '>', $err_f or BAIL_OUT $!;
         $gcf2c = PublicInbox::Gcf2Client::new({ 2 => $err });
-        $gcf2c->add_git_dir($git_b);
-        $gcf2c->cat_async($tree, sub {
+        $gcf2c->cat_async("$tree $git_b", sub {
                 my ($bref, $oid, $type, $size, $arg) = @_;
                 is(undef, $bref, 'missing bref from alt is undef');
                 $called++;
@@ -79,7 +76,7 @@ my $err_f = "$tmpdir/err";
         print $alt "$git_a/objects\n" or BAIL_OUT $!;
         close $alt or BAIL_OUT;
         my $expect = xqx(['git', "--git-dir=$git_a", qw(cat-file tree), $tree]);
-        $gcf2c->cat_async($tree, sub {
+        $gcf2c->cat_async("$tree $git_a", sub {
                 my ($bref, $oid, $type, $size, $arg) = @_;
                 is($oid, $tree, 'oid match on alternates retry');
                 is($$bref, $expect, 'tree content matched');