chiark / gitweb /
dgit: split brain reorg: Check $split_brain against $do_split_brain
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 6 Jun 2019 15:23:43 +0000 (16:23 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 28 Jun 2019 11:45:38 +0000 (12:45 +0100)
I think by now, $do_split_brain is always set early enough that
$split_brain here implies $do_split_brain.  And if $split_brain were
not set but $do_split_brain was, that would mean we hadn't actually
done the necessary work (constructing the and switching to the
dgit-view branch in the playtree or computing $dgithead).

Double check this with a couple of calls to confess.

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

diff --git a/dgit b/dgit
index 4bc088e6ffc0112f40a37a63c65844b5bc3dd422..2b1a29309e4a22a46f032f81ba3127221a3d887e 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -4578,6 +4578,7 @@ END
     my $r = system @diffcmd;
     if ($r) {
        if ($r==256) {
+           confess unless !!$split_brain == !!$do_split_brain;
            my $referent = $split_brain ? $dgithead : 'HEAD';
            my $diffs = cmdoutput @git, qw(diff --stat), $tree, $dgithead;
 
@@ -6778,6 +6779,7 @@ sub build_source {
         # If we are in split brain, there is already a playtree with
         # the thing we should package into a .dsc (thanks to quilt
         # fixup).  If not, make a playtree
+       confess unless !!$split_brain == !!$do_split_brain;
         prep_ud() unless $split_brain;
         changedir $playground;
         unless ($split_brain) {