From: Ian Jackson Date: Sat, 4 Aug 2018 09:35:58 +0000 (+0100) Subject: git-debrebase: Properly reject bare dgit dsc imports X-Git-Tag: archive/debian/6.5~14 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=32302c566f46426687ae9dcccec2f16ddeb56e4b git-debrebase: Properly reject bare dgit dsc imports A bare dgit dsc import is not a legal gdr branch, because the main merge contains debian/patches/. So it cannot be processed without conversion. Previously an attempt to launder such a branch would crash with a stack trace, although keycommits would falsely claim it was OK Signed-off-by: Ian Jackson --- diff --git a/debian/changelog b/debian/changelog index 491e80f4..664a3d1f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ dgit (6.5~) unstable; urgency=medium * dgit: Rename --dgit-view-save to --save-dgit-view, leaving an alias. * dgit: Provide print-unapplied-treeish subcommand. * dgit: Improve error message for unknown suite, to suggest -d. + * git-debrebase: Properly reject bare dgit dsc imports -- diff --git a/git-debrebase b/git-debrebase index 13c320e8..a2a14ca6 100755 --- a/git-debrebase +++ b/git-debrebase @@ -595,6 +595,7 @@ sub keycommits ($;$$$$) { my ($anchor, $breakwater); my $clogonly; my $cl; + my $found_pm; $fatal //= sub { fail $_[1]; }; my $x = sub { my ($cb, $tagsfx, $mainwhy, $xwhy) = @_; @@ -634,12 +635,20 @@ sub keycommits ($;$$$$) { $breakwater = undef; } elsif ($ty eq 'Pseudomerge' or $ty eq 'AddPatches') { + my $found_pm = 1; $x->($furniture, (lc $ty), "found interchange bureaucracy commit ($ty)"," ($head)"); } elsif ($ty eq 'DgitImportUnpatched') { - $x->($trouble, 'dgitimport', - "found dgit dsc import ($head)"); - return (undef,undef); + if ($found_pm) { + $x->($trouble, 'dgitimport', + "found dgit dsc import"," ($head)"); + return (undef,undef); + } else { + $x->($fatal, 'unprocessable', + "found bare dgit dsc import with no prior history", + " ($head)"); + return (undef,undef); + } } else { $x->($fatal, 'unprocessable', "found unprocessable commit, cannot cope: $cl->{Why}", @@ -814,13 +823,12 @@ sub walk ($;$$) { next; } else { # Everything is from this import. This kind of import - # is already in valid breakwater format, with the - # patches as commits. - printf $report " NoPM" if $report; - # 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); + # is already nearly in valid breakwater format, with the + # patches as commits. Unfortunately it contains + # debian/patches/. + printdebug "*** WALK BOMB bare dgit import\n"; + $cl->{Why} = "bare dgit dsc import"; + return $bomb->(); } die "$ty ?"; } else {