chiark / gitweb /
Split brain: Fix unapplied tree handling
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 Jul 2016 18:46:40 +0000 (19:46 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Jul 2016 15:47:48 +0000 (16:47 +0100)
Do the quiltify_splitbrain_needed if there _are_ patches, not if there
aren't.  And if we're told it was an unapplied tree, check that HEAD
and orig are indeed the same (excluding debian/*, of course) and print
a useful message if not.

dgit

diff --git a/dgit b/dgit
index 3f637f1..55d71f9 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2578,9 +2578,20 @@ sub quiltify_splitbrain ($$$$$$) {
     local $ENV{GIT_COMMITTER_NAME} =  $authline[0];
     local $ENV{GIT_COMMITTER_EMAIL} = $authline[1];
     local $ENV{GIT_COMMITTER_DATE} =  $authline[2];
+       
     if ($quilt_mode =~ m/gbp|unapplied/ &&
-       ($diffbits->{O2A} & 01) && # some patches
-       !($diffbits->{H2O} & 01)) { # but HEAD is like orig
+       ($diffbits->{H2O} & 01)) {
+       my $msg =
+ "--quilt=$quilt_mode specified, implying patches-unapplied git tree\n".
+ " but git tree differs from orig in upstream files.";
+       if (!stat_exists "debian/patches") {
+           $msg .=
+ "\n ... debian/patches is missing; perhaps this is a patch queue branch?";
+       }  
+       fail $msg;
+    }
+    if ($quilt_mode =~ m/gbp|unapplied/ &&
+       ($diffbits->{O2A} & 01)) { # some patches
        quiltify_splitbrain_needed();
        progress "creating patches-applied version using gbp-pq";
        open STDOUT, ">/dev/null" or die $!;