From: Ian Jackson Date: Sun, 19 Aug 2018 18:18:42 +0000 (+0100) Subject: git-debrebase: convert-from-*: Snag on unused patches X-Git-Tag: archive/debian/6.7~39 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=6152f859fc4fa61b485362a6ff5613f436883db8;hp=813a7ced61b4c18222f43b31c10ad7b4c8e16bf1 git-debrebase: convert-from-*: Snag on unused patches Patches in d/patches which are not in series will be deleted, and not represented in the output. So call them a snag. Closes:#904997. Signed-off-by: Ian Jackson --- diff --git a/debian/changelog b/debian/changelog index 5fe69041..3f18752a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,8 @@ dgit (6.7~) unstable; urgency=medium unstitched. This is more friendly. * git-debrebase: On rebase, always save ffq-prev even if we were both stitched and laundered. Closes:#905975. + * git-debrebase: convert-from-*: Snag on patches in d/patches which are + not in series, because they will be deleted. Closes:#904997. -- diff --git a/git-debrebase b/git-debrebase index 5a9a9cbe..66167b2b 100755 --- a/git-debrebase +++ b/git-debrebase @@ -2390,6 +2390,24 @@ sub cmd_make_patches () { } } +sub check_series_has_all_patches ($) { + my ($head) = @_; + my $seriesfn = 'debian/patches/series'; + my ($dummy, $series) = git_cat_file "$head:$seriesfn", + [qw(blob missing)]; + $series //= ''; + my %series; + foreach my $f (grep /\S/, grep {!m/^\s\#/} split /\n/, $series) { + fail "patch $f repeated in $seriesfn !" if $series{$f}++; + } + foreach my $patchfile (get_tree "$head:debian/patches", 1,1) { + my ($f,$i) = @$patchfile; + next if $series{$f}; + next if $f eq 'series'; + snag 'unused-patches', "Unused patch file $f will be discarded"; + } +} + sub cmd_convert_from_gbp () { badusage "want only 1 optional argument, the upstream git commitish" unless @ARGV<=1; @@ -2437,6 +2455,8 @@ END "upstream ($upstream) contains debian/ directory"; } + check_series_has_all_patches $old_head; + my $previous_dgit_view = eval { my @clogcmd = qw(dpkg-parsechangelog --format rfc822 -n2); my ($lvsn, $suite); @@ -2587,6 +2607,8 @@ END } } + check_series_has_all_patches $head; + snags_maybe_bail_early(); my $version = upstreamversion $clogp->{Version};