chiark / gitweb /
dgit: unrepres. changes: Separate out creation and deletion
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 16 Jul 2017 10:26:32 +0000 (11:26 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 16 Jul 2017 11:46:28 +0000 (12:46 +0100)
We are going to want to handle these cases separately because the
behaviour of dpkg-source is different.

In this commit, simply clone the existing code (and add a few
comments), so no functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index 8b9934b807c020233bc9f90d76487988460e2b30..1f1563075bbc065d80fea603c5e5e2bb05d41631 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -4915,9 +4915,16 @@ sub quiltify_trees_differ ($$;$$$) {
                           $oldmode =~ m/^(?:10|12)\d{4}$/;
                if ($oldmode =~ m/[^0]/ &&
                    $newmode =~ m/[^0]/) {
+                   # both old and new files exist
                    die "mode or type changed\n" if $oldmode ne $newmode;
                    die "modified symlink\n" unless $newmode =~ m/^10/;
+               } elsif ($oldmode =~ m/[^0]/) {
+                   # deletion
+                   die "non-default mode or type\n"
+                       unless $newmode =~ m/^100644$/ ||
+                              $oldmode =~ m/^100644$/;
                } else {
+                   # creation
                    die "non-default mode or type\n"
                        unless $newmode =~ m/^100644$/ ||
                               $oldmode =~ m/^100644$/;