chiark / gitweb /
dgit: Fix check for --include-dirty --quilt=<splitting>
[dgit.git] / dgit
diff --git a/dgit b/dgit
index e940224871590954d2fa7a1272ead350cb5b19fe..493828695680a3ee7f72f9c2660c83f257b0d751 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,20 @@ 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;
+    }
+    fail __ "dgit: --include-dirty is not supported in split view quilt mode"
+       if $do_split_brain && $includedirty;
+}
+
 sub build_prep_early () {
     build_or_push_prep_early();
     notpushing();
+    build_or_push_prep_modes();
     check_not_dirty();
 }
 
@@ -7574,11 +7580,6 @@ sub parseopts_late_defaults () {
        $$vr = $v;
     }
 
-    fail __ "dgit: --include-dirty is not supported in split view quilt mode"
-       # xxx this does not actually work, because $split brain is
-       #     not set this early
-       if $split_brain && $includedirty;
-
     if (!defined $cleanmode) {
        local $access_forpush;
        $cleanmode = access_cfg('clean-mode-newer', 'RETURN-UNDEF');