chiark / gitweb /
git-debrebase: merge: Refactor interchange merge-base computation
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 15:13:34 +0000 (16:13 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 15:17:06 +0000 (16:17 +0100)
We need to unpack this a bit so that we can insert some wrecknote
stuff, which will come in a moment.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index 1e8de52..f93adef 100755 (executable)
@@ -1235,12 +1235,22 @@ sub walk ($;$$$) {
            # breakwater merge base as an ancestor.
 
            my @ibs =
-               grep { is_fast_fwd $bwb, $_ }
                grep /./,
                split /\n/,
                cmdoutput @ibcmd;
-           my ($ib) = @ibs
-               or $nomerge->("no suitable interchange merge base");
+
+            @ibs or confess 'internal error, expected anchor at least ?';
+
+           my $ib;
+           foreach my $tibix (0..$#ibs) {
+               my $tib = $ibs[$tibix];
+               my $ff = is_fast_fwd $bwb, $tib;
+               next unless $ff;
+               next if $ib;
+               $ib = $tib;
+           }
+
+           $ib or $nomerge->("no suitable interchange merge base");
 
            $prline->("  VanillaMerge Base");
            $prprdelim->();