chiark / gitweb /
dgit: split brain reorg: Move do_split_brain setting
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 6 Jun 2019 14:01:48 +0000 (15:01 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 28 Jun 2019 11:45:38 +0000 (12:45 +0100)
We have to introduce a new "time", build_or_push_prep_modes, which is
the point at which we know we have a working tree, and know the quilt
mode, and know we are pushing or building.

There is one call to build_or_push_prep_modes near every call to
build_or_push_prep_early - after pushing/notpushing (which also means
after parseopts_late_defaults).

There is one nontrivial functional difference: Now we use the format
from the working tree, rather than from the .dsc.  But these ought to
be identical in any sane situation.  If they are not then the user has
done something very strange.  The quilt fixup machinery may go wrong,
but we should detect a problem later, during the dpkg-source -x check,
so nothing wrong will be pushed anywhere.

Otherwise no overall functional change other than to debug output.

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

diff --git a/dgit b/dgit
index e940224871590954d2fa7a1272ead350cb5b19fe..7aae321a4c9fa574a1faba50f56cb10816964186 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -4489,7 +4489,6 @@ END
     push_parse_dsc($dscpath, $dscfn, $cversion);
 
     my $format = getfield $dsc, 'Format';
-    printdebug "format $format\n";
 
     my $symref = git_get_symref();
     my $actualhead = git_rev_parse('HEAD');
@@ -4515,9 +4514,6 @@ END
 
     if (madformat_wantfixup($format)) {
        # user might have not used dgit build, so maybe do this now:
-       if (quiltmode_splitbrain()) {
-           $do_split_brain = 1;
-       }
        if ($do_split_brain) {
            changedir $playground;
            my $cachekey;
@@ -4982,6 +4978,7 @@ sub prep_push () {
     parseopts();
     build_or_push_prep_early();
     pushing();
+    build_or_push_prep_modes();
     check_not_dirty();
     my $specsuite;
     if (@ARGV==0) {
@@ -5812,8 +5809,6 @@ sub build_maybe_quilt_fixup () {
 
     check_for_vendor_patches();
 
-    $do_split_brain = 1 if quiltmode_splitbrain();
-
     my $clogp = parsechangelog();
     my $headref = git_rev_parse('HEAD');
     my $symref = git_get_symref();
@@ -6440,9 +6435,18 @@ sub build_or_push_prep_early () {
     $dscfn = dscfn($version);
 }
 
+sub build_or_push_prep_modes () {
+    my ($format,) = get_source_format();
+    printdebug "format $format\n";
+    if (madformat_wantfixup($format) && quiltmode_splitbrain()) {
+       $do_split_brain = 1;
+    }
+}
+
 sub build_prep_early () {
     build_or_push_prep_early();
     notpushing();
+    build_or_push_prep_modes();
     check_not_dirty();
 }