chiark / gitweb /
rebase: go back to my $build
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 21 Jun 2017 20:40:24 +0000 (21:40 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 24 Aug 2017 14:43:40 +0000 (15:43 +0100)
We never don't have exactly one parent

git-debrebase

index 4fb5e91fd7e62c96a41a6b27b0ed5e15519d77ef..e83822c27cfbaa88f1aa7afafe154bfbc91c2964 100755 (executable)
@@ -354,9 +354,9 @@ sub walk {
     };
 
     my $build_start = sub {
-       my ($msg, $parents) = @_;
+       my ($msg, $parent) = @_;
        $prline->(" $msg");
-       push @brw_cl, { ExactlyParents => $parents };
+       $build = $parent;
        no warnings qw(exiting); last;
     };
 
@@ -369,10 +369,9 @@ sub walk {
        die "commit $cur: Cannot cope with this commit";
     };
 
+    my $build;
+
     for (;;) {
-       if (!defined $cur) {
-           $build_start->('Origin', []);
-       }
        $cl = classify $cur;
        my $ty = $cl->{Type};
        my $st = $cl->{SubType};
@@ -389,7 +388,7 @@ sub walk {
            $cur = $p0;
            next;
        } elsif ($ty eq 'BreakwaterStart') {
-           $build_start->('FirstPackaging',[$cur]);
+           $build_start->('FirstPackaging', $cur);
        } elsif ($ty eq 'Upstream') {
            push @upp_cl, $cl;
            $cur = $p0;
@@ -412,7 +411,7 @@ sub walk {
            $cur = $ty->{Contributor};
            next;
        } elsif ($ty eq 'BreakwaterUpstreamMerge') {
-           $build_start->("PreviousBreakwater", [$cur]);
+           $build_start->("PreviousBreakwater", $cur);
        } elsif ($ty eq 'DgitImportUnpatched') {
            my $pm = $pseudomerges[-1];
            if (defined $pm) {
@@ -475,7 +474,7 @@ sub walk {
                # last thing we processed will have been the first patch,
                # if there is one; which is fine, so no need to rewrite
                # on account of this import
-               $build_start->("ImportOrigin",[$cur]);
+               $build_start->("ImportOrigin", $cur);
            }
            die "$ty ?";
         } else {
@@ -491,8 +490,6 @@ sub walk {
 
     my $rewriting = 0;
 
-    my $build = $basis;
-
     my $rm_tree_cached = sub {
        my ($subdir) = @_;
        runcmd @git, qw(rm --quiet -rf --cached), $subdir;
@@ -531,8 +528,8 @@ sub walk {
                $rewriting = 1;
                next;
            } elsif ($method eq 'RecordBreakwaterTip') {
-               last if $wantbrwonly;
                $breakwater = $build;
+               last if $wantbrwonly;
                next;
            } elsif ($method eq 'DgitImportDebianUpdate') {
                $read_tree_debian->($cltree);