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 9d8b21447d7e77684476e91404e1a94869a4b4b2..64ed65c9bc2e6317bd73bd2934fe7d826234c528 100644 (file)
@@ -1,6 +1,9 @@
 dgit (2.13~) unstable; urgency=medium
 
 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 1502ddff922109ec771f25eecf09f3648b0bb57d..9a8d22147a9b0a80e93f54c20b64a5113c7e962a 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;
        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 {
 
        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 "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 ($@) {
                }
            };
            if ($@) {
index 88a697230e01ae088c91e98be2955fa18b489504..9dd2111baac87ff3db7f25c4649866f3e901d63c 100755 (executable)
@@ -30,9 +30,10 @@ badly-1 symlink 'not a plain file'
        git add symlink
 badly-2
 
        git add symlink
 badly-2
 
-badly-1 src.c deleted
+start
        git rm src.c
        git rm src.c
-badly-2
+       git commit -m deleted
+attempt
 
 badly-1 src.c 'mode changed'
        chmod +x src.c
 
 badly-1 src.c 'mode changed'
        chmod +x src.c