From acf296f554f89df4b2cc3a8ac6458ef3da9b21d3 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 6 Jun 2019 15:01:48 +0100 Subject: [PATCH] dgit: split brain reorg: Move do_split_brain setting 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 --- dgit | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dgit b/dgit index e9402248..7aae321a 100755 --- 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(); } -- 2.30.2