chiark / gitweb /
git-debrebase: keycommits: Handle merged-breakwater commits
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 11:25:20 +0000 (12:25 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 11:25:20 +0000 (12:25 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index 8ddf18dacf295670ba07270bfd5f2987d47c26f9..672551d5e921ea30ad7728952b2602e5e98c7299 100755 (executable)
@@ -810,6 +810,21 @@ sub classify ($) {
     return $classify->("VanillaMerge");
 }
 
     return $classify->("VanillaMerge");
 }
 
+sub keycommits ($;$$$$$);
+
+sub mergedbreakwaters_anchor ($) {
+    my ($cl) = @_;
+    my $best_anchor;
+    foreach my $p (@{ $cl->{Parents} }) {
+       my ($panchor, $pbw) = keycommits $p->{CommitId},
+           undef,undef,undef,undef, 1;
+       $best_anchor = $panchor
+           if !defined $best_anchor
+           or is_fast_fwd $best_anchor, $panchor;
+    }
+    return $best_anchor;
+}
+
 sub keycommits ($;$$$$$) {
     my ($head, $furniture, $unclean, $trouble, $fatal, $claimed_bw) = @_;
     # => ($anchor, $breakwater)
 sub keycommits ($;$$$$$) {
     my ($head, $furniture, $unclean, $trouble, $fatal, $claimed_bw) = @_;
     # => ($anchor, $breakwater)
@@ -901,6 +916,8 @@ sub keycommits ($;$$$$$) {
            $x->($trouble, 'vanillamerge',
                 "found vanilla merge"," ($head)");
            return (undef,undef);
            $x->($trouble, 'vanillamerge',
                 "found vanilla merge"," ($head)");
            return (undef,undef);
+       } elsif ($ty eq 'MergedBreakwaters') {
+           $found_anchor->(mergedbreakwaters_anchor $cl);
        } else {
            $x->($fatal, 'unprocessable',
                 "found unprocessable commit, cannot cope: $cl->{Why}",
        } else {
            $x->($fatal, 'unprocessable',
                 "found unprocessable commit, cannot cope: $cl->{Why}",