chiark / gitweb /
quilt fixup: Permit creation of patches which delete files
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 20 Dec 2016 21:14:48 +0000 (21:14 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 20 Dec 2016 21:37:56 +0000 (21:37 +0000)
By psssing --include-removal to dpkg-source, and tolerating it when we
do our quilt fixup analysis.

dpkg-source has supported this since at least stretch.

Closes:#848901.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/changelog
dgit
tests/tests/unrepresentable

index 9d8b214..64ed65c 100644 (file)
@@ -1,6 +1,9 @@
 dgit (2.13~) unstable; urgency=medium
 
-  * 
+  * quilt fixup: Permit creation of patches which delete files, by psssing
+    --include-removal to dpkg-source, and tolerating it when we do our
+    quilt fixup analysis.  dpkg-source has supported this since at least
+    stretch.  Closes:#848901.
 
  --
 
diff --git a/dgit b/dgit
index 1502ddf..9a8d221 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -4460,7 +4460,7 @@ END
        local $ENV{'EDITOR'} = cmdoutput qw(realpath --), $0;
        local $ENV{'VISUAL'} = $ENV{'EDITOR'};
        local $ENV{$fakeeditorenv} = cmdoutput qw(realpath --), $descfn;
-       runcmd @dpkgsource, qw(--commit .), $patchname;
+       runcmd @dpkgsource, qw(--commit --include-removal .), $patchname;
     }
 }
 
@@ -4495,12 +4495,16 @@ sub quiltify_trees_differ ($$;$$$) {
 
        if ($unrepres) {
            eval {
-               die "deleted\n" unless $newmode =~ m/[^0]/;
-               die "not a plain file\n" unless $newmode =~ m/^10\d{4}$/;
-               if ($oldmode =~ m/[^0]/) {
+               die "not a plain file\n"
+                   unless $newmode =~ m/^10\d{4}$/ ||
+                          $oldmode =~ m/^10\d{4}$/;
+               if ($oldmode =~ m/[^0]/ &&
+                   $newmode =~ m/[^0]/) {
                    die "mode changed\n" if $oldmode ne $newmode;
                } else {
-                   die "non-default mode\n" unless $newmode =~ m/^100644$/;
+                   die "non-default mode\n"
+                       unless $newmode =~ m/^100644$/ ||
+                              $oldmode =~ m/^100644$/;
                }
            };
            if ($@) {
index 88a6972..9dd2111 100755 (executable)
@@ -30,9 +30,10 @@ badly-1 symlink 'not a plain file'
        git add symlink
 badly-2
 
-badly-1 src.c deleted
+start
        git rm src.c
-badly-2
+       git commit -m deleted
+attempt
 
 badly-1 src.c 'mode changed'
        chmod +x src.c