chiark / gitweb /
git-debrebase: convert-from-*: Snag on unused patches
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Aug 2018 18:18:42 +0000 (19:18 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Aug 2018 18:18:43 +0000 (19:18 +0100)
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 <ijackson@chiark.greenend.org.uk>
debian/changelog
git-debrebase

index 5fe69041275c027c09a0cd3cfa8a91fecae9c59f..3f18752a52b9aa7e52c85a79b00dcd58e8486040 100644 (file)
@@ -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.
 
  --
 
index 5a9a9cbe10886ded4019ffbfe8669ed2de7a01cb..66167b2bafd501671885cbb7db43984d200d6aa5 100755 (executable)
@@ -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};