From: Ian Jackson Date: Wed, 21 Jun 2017 20:40:24 +0000 (+0100) Subject: git-debrebase: rebase: go back to my $build X-Git-Tag: archive/debian/5.0~343 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=c3d0030260d0afae7d375977bc36a1f8e7eab8cb git-debrebase: rebase: go back to my $build We never don't have exactly one parent --- diff --git a/git-debrebase b/git-debrebase index 4fb5e91f..e83822c2 100755 --- a/git-debrebase +++ b/git-debrebase @@ -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);