about summary refs log tree commit homepage
path: root/lib/PublicInbox/SolverGit.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-01-29 04:01:21 +0000
committerEric Wong <e@80x24.org>2019-01-29 21:36:02 +0000
commiteb522a29e437eda6de0d50c739d73f9e9ec4adbc (patch)
tree5a5d6deb7662e9bd3d725081a08aa205b070b043 /lib/PublicInbox/SolverGit.pm
parenta6f2d5b61e37a49d8278b250d172b497a88c2b45 (diff)
downloadpublic-inbox-eb522a29e437eda6de0d50c739d73f9e9ec4adbc.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/SolverGit.pm')
-rw-r--r--lib/PublicInbox/SolverGit.pm4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
index 39acbe41..24d9da2f 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 } ];