From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DBE432141E for ; Wed, 30 Jan 2019 04:44:31 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 05/11] solvergit: do not solve blobs twice Date: Wed, 30 Jan 2019 04:44:24 +0000 Message-Id: <20190130044430.28189-6-e@80x24.org> In-Reply-To: <20190130044430.28189-1-e@80x24.org> References: <20190130044430.28189-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: In some cases, a file may ping-pong between blob IDs in the same message when reverts occur. So break out of this early. This doesn't account for different abbreviations, but the limited variations of abbreviations should alleviate the problem. --- lib/PublicInbox/SolverGit.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index 39acbe4..24d9da2 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -439,6 +439,9 @@ sub resolve_patch ($$) { # see if we can find the blob in an existing git repo: my $cur_want = $want->{oid_b}; + if ($self->{seen_oid}->{$cur_want}++) { + die "Loop detected solving $cur_want\n"; + } if (my $existing = solve_existing($self, $want)) { dbg($self, "found $cur_want in " . join("\n", $existing->[0]->pub_urls)); @@ -504,6 +507,7 @@ sub solve ($$$$$) { $self->{oid_want} = $oid_want; $self->{out} = $out; + $self->{seen_oid} = {}; $self->{tot} = 0; $self->{psgi_env} = $env; $self->{todo} = [ { %$hints, oid_b => $oid_want } ]; -- EW