chiark / gitweb /
Split brain: some work on integration into the rest of dgit
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 28 Nov 2015 17:43:33 +0000 (17:43 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Jul 2016 15:47:47 +0000 (16:47 +0100)
* Move the fast forward die to where we will need to make the
  synthetic commit, so that the tree equality check is done on the
  thing we will actually push.

* Crash if we are trying to do split brain without split build.
  (This should never happen.)

* Set split build if we need split brain.

dgit

diff --git a/dgit b/dgit
index 4b4380b40f2a0ec7c12151154ab92a4b9531facf..4d31cd606b568e4b7df586de3b802ada2a9a909d 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1988,10 +1988,14 @@ END
 
     my $format = getfield $dsc, 'Format';
     printdebug "format $format\n";
 
     my $format = getfield $dsc, 'Format';
     printdebug "format $format\n";
+
     if (madformat($format)) {
        # user might have not used dgit build, so maybe do this now:
        commit_quilty_patch();
     }
     if (madformat($format)) {
        # user might have not used dgit build, so maybe do this now:
        commit_quilty_patch();
     }
+
+    die 'xxx fast forward (should not depend on quilt mode, but will always be needed if we did $split_brain)' if $split_brain;
+
     check_not_dirty();
     changedir $ud;
     progress "checking that $dscfn corresponds to HEAD";
     check_not_dirty();
     changedir $ud;
     progress "checking that $dscfn corresponds to HEAD";
@@ -2628,7 +2632,6 @@ END
     runcmd @git, qw(update-ref -m), $cachekey, "refs/$splitbraincache",
        $dgitview;
 
     runcmd @git, qw(update-ref -m), $cachekey, "refs/$splitbraincache",
        $dgitview;
 
-    die 'xxx fast forward (should not depend on quilt mode, but will always be needed if we did $split_brain)';
     changedir '.git/dgit/unpack/work';
 }
 
     changedir '.git/dgit/unpack/work';
 }
 
@@ -2865,6 +2868,8 @@ sub build_maybe_quilt_fixup () {
        quilt_fixup_multipatch($clogp, $headref, $upstreamversion);
     }
 
        quilt_fixup_multipatch($clogp, $headref, $upstreamversion);
     }
 
+    die 'bug' if $split_brain && !$need_split_build_invocation;
+
     changedir '../../../..';
     runcmd_ordryrun_local
         @git, qw(pull --ff-only -q .git/dgit/unpack/work master);
     changedir '../../../..';
     runcmd_ordryrun_local
         @git, qw(pull --ff-only -q .git/dgit/unpack/work master);
@@ -3773,6 +3778,8 @@ if (!defined $quilt_mode) {
     $quilt_mode = $1;
 }
 
     $quilt_mode = $1;
 }
 
+$need_split_build_invocation ||= quiltmode_splitbrain();
+
 if (!defined $cleanmode) {
     local $access_forpush;
     $cleanmode = access_cfg('clean-mode', 'RETURN-UNDEF');
 if (!defined $cleanmode) {
     local $access_forpush;
     $cleanmode = access_cfg('clean-mode', 'RETURN-UNDEF');