chiark / gitweb /
git-debrebase: keycommits: Break out $found_anchor
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 11:22:54 +0000 (12:22 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 11:22:54 +0000 (12:22 +0100)
We are going to want to reuse this.

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

index 3d8d6f3..06cdc76 100755 (executable)
@@ -846,6 +846,13 @@ sub keycommits ($;$$$$) {
        return unless $cb;
        $cb->("unclean-$tagsfx", $why, $cl, $mainwhy);
     };
+    my $found_anchor = sub {
+       ($anchor) = @_;
+       $breakwater //= $clogonly;
+       $breakwater //= $head;
+       no warnings qw(exiting);
+       last;
+    };
     for (;;) {
        $cl = classify $head;
        my $ty = $cl->{Type};
@@ -859,10 +866,7 @@ sub keycommits ($;$$$$) {
        } elsif ($ty eq 'Anchor' or
                 $ty eq 'TreatAsAnchor' or
                 $ty eq 'BreakwaterStart') {
-           $anchor = $head;
-           $breakwater //= $clogonly;
-           $breakwater //= $head;
-           last;
+           $found_anchor->($head);
        } elsif ($ty eq 'Upstream') {
            $x->($unclean, 'ordering',
  "packaging change ($breakwater) follows upstream change"," (eg $head)")