chiark / gitweb /
dgit: split brain reorg: Slight internal error check improvements
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 6 Jun 2019 15:33:10 +0000 (16:33 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 28 Jun 2019 11:45:38 +0000 (12:45 +0100)
Move the $made_split_brain and $do_split_brain checks outside various
conditionals.  And change a die to a confess.

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

diff --git a/dgit b/dgit
index 7808fd825c43a836f830c7440bffecb37e85a022..920787457bd271b3aecef6d0eecb8c1f924d9200 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -4565,6 +4565,8 @@ END
        }
     }
 
+    confess unless !!$made_split_brain == !!$do_split_brain;
+
     changedir $playground;
     progress f_ "checking that %s corresponds to HEAD", $dscfn;
     runcmd qw(dpkg-source -x --),
@@ -4578,7 +4580,6 @@ END
     my $r = system @diffcmd;
     if ($r) {
        if ($r==256) {
-           confess unless !!$made_split_brain == !!$do_split_brain;
            my $referent = $made_split_brain ? $dgithead : 'HEAD';
            my $diffs = cmdoutput @git, qw(diff --stat), $tree, $dgithead;
 
@@ -5837,7 +5838,7 @@ sub build_maybe_quilt_fixup () {
        # remain dgit-view, rather than master, so subsequent calls to
        #  unpack_playtree_need_cd_work
        # will DTRT, resetting dgit-view.
-       die if $made_split_brain;
+       confess if $made_split_brain;
        $made_split_brain = 1;
     }
     chdir '..';
@@ -6771,6 +6772,8 @@ sub build_source {
        unlink "$buildproductsdir/$sourcechanges" or $!==ENOENT
            or fail f_ "remove %s: %s", $sourcechanges, $!;
     }
+    confess unless !!$made_split_brain == !!$do_split_brain;
+
     my @cmd = (@dpkgsource, qw(-b --));
     my $leafdir;
     if (building_source_in_playtree()) {
@@ -6779,7 +6782,6 @@ 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 !!$made_split_brain == !!$do_split_brain;
         prep_ud() unless $made_split_brain;
         changedir $playground;
         unless ($made_split_brain) {