From 048c26164775aaf523086e60b4a975279341c3e2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 10 Jul 2016 19:46:40 +0100 Subject: [PATCH] Split brain: Fix unapplied tree handling 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 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dgit b/dgit index 3f637f13..55d71f91 100755 --- 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 $!; -- 2.30.2