From da894f5bc73ad2a5cbf6d74533818ca359f141b0 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 16 Feb 2018 20:24:56 +0000 Subject: [PATCH] git-debrebase: DgitImportUnpatched: defer upstream diff check We can't do this during the initial walk, because what we ought to be comparing is the previous breakwater with the new one. So we have to wait until the walk has proceeded down the overwritten branch, to find the old breakwater. This can be done by waiting until we are rebuilding the branch: at that point, we have just built the previous breakwater, so we can compare it to the dgit unpatched import. Signed-off-by: Ian Jackson --- git-debrebase | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/git-debrebase b/git-debrebase index bdde809d..ad2672f1 100755 --- a/git-debrebase +++ b/git-debrebase @@ -651,22 +651,12 @@ sub walk ($;$$) { %$cl, SpecialMethod => 'DgitImportDebianUpdate', $xmsg->("convert dgit import: debian changes") + }, { + %$cl, + SpecialMethod => 'DgitImportUpstreamUpdate', + $xmsg->("convert dgit import: upstream update", + " breakwater") }; - my $differs = (get_differs $ovwr, $cl->{Tree}); - printf $report " Differs=%#x", $differs if $report; - if ($differs & D_UPS) { - printf $report " D_UPS" if $report; - # This will also trigger if a non-dgit git-based NMU - # deleted .gitignore (which is a thing that some of - # the existing git tools do if the user doesn't - # somehow tell them not to). Ah well. - push @brw_cl, { - %$cl, - SpecialMethod => 'DgitImportUpstreamUpdate', - $xmsg->("convert dgit import: upstream changes", - " breakwater") - }; - } $prline->(" Import"); $rewrite_from_here->(); $upp_limit //= $#upp_cl; # further, deeper, patches discarded @@ -749,6 +739,9 @@ sub walk ($;$$) { $read_tree_debian->($cltree); rm_subdir_cached qw(debian/patches); } elsif ($method eq 'DgitImportUpstreamUpdate') { + confess unless $rewriting; + my $differs = (get_differs $build, $cltree); + next unless $differs & D_UPS; $read_tree_upstream->($cltree); push @parents, map { $_->{CommitId} } @{ $cl->{OrigParents} }; } else { -- 2.30.2