From: Ian Jackson Date: Fri, 28 Jun 2019 14:04:42 +0000 (+0100) Subject: dgit: Introduce do_split_brain() X-Git-Tag: archive/debian/9.0~96 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=6b957cc704219e34b6d75cfe779a33bd97d3427f dgit: Introduce do_split_brain() No functional change yet. Signed-off-by: Ian Jackson --- diff --git a/dgit b/dgit index b104b7ce..35b61a5e 100755 --- a/dgit +++ b/dgit @@ -189,7 +189,7 @@ our $do_split_brain = 0; # # no split no q cache no q cache forbidden, # brain PM on master q fixup on master prevented -# !$do_split_brain PM on master +# !do_split_brain() PM on master # # split brain no q cache q fixup cached, to dgit view # PM in dgit view PM in dgit view @@ -295,6 +295,8 @@ sub quiltmode_splitbrain () { $quilt_mode =~ m/gbp|dpm|unapplied/; } +sub do_split_brain () { $do_split_brain // confess } + sub opts_opt_multi_cmd { my $extra = shift; my @cmd; @@ -4453,7 +4455,7 @@ END if (madformat_wantfixup($format)) { # user might have not used dgit build, so maybe do this now: - if ($do_split_brain) { + if (do_split_brain()) { changedir $playground; my $cachekey; ($dgithead, $cachekey) = @@ -4463,13 +4465,13 @@ END perhaps HEAD changed since dgit build[-source] ?", $quilt_mode; } - if (!$do_split_brain) { + if (!do_split_brain()) { # In split brain mode, do not attempt to incorporate dirty # stuff from the user's working tree. That would be mad. commit_quilty_patch(); } } - if ($do_split_brain) { + if (do_split_brain()) { $made_split_brain = 1; $dgithead = splitbrain_pseudomerge($clogp, $actualhead, $dgithead, @@ -4504,7 +4506,7 @@ END } } - confess unless !!$made_split_brain == !!$do_split_brain; + confess unless !!$made_split_brain == !!do_split_brain(); changedir $playground; progress f_ "checking that %s corresponds to HEAD", $dscfn; @@ -5349,7 +5351,7 @@ sub quiltify_splitbrain ($$$$$$$) { local $ENV{GIT_AUTHOR_EMAIL} = $authline[1]; local $ENV{GIT_AUTHOR_DATE} = $authline[2]; - confess unless $do_split_brain; + confess unless do_split_brain(); my $fulldiffhint = sub { my ($x,$y) = @_; @@ -5735,7 +5737,7 @@ sub build_maybe_quilt_fixup () { my $splitbrain_cachekey; - if ($do_split_brain) { + if (do_split_brain()) { my $cachehit; ($cachehit, $splitbrain_cachekey) = quilt_check_splitbrain_cache($headref, $upstreamversion); @@ -5746,7 +5748,7 @@ sub build_maybe_quilt_fixup () { } unpack_playtree_need_cd_work($headref); - if ($do_split_brain) { + if (do_split_brain()) { runcmd @git, qw(checkout -q -b dgit-view); # so long as work is not deleted, its current branch will # remain dgit-view, rather than master, so subsequent calls to @@ -5768,7 +5770,7 @@ sub build_maybe_quilt_fixup () { $splitbrain_cachekey); } - if ($do_split_brain) { + if (do_split_brain()) { my $dgitview = git_rev_parse 'HEAD'; changedir $maindir; @@ -6208,7 +6210,7 @@ END progress f_ "starting quiltify (multiple patches, %s mode)", $quilt_mode; quiltify($clogp,$headref,$oldtiptree,\@failsuggestion); - runcmd @git, qw(checkout -q), (qw(master dgit-view)[!!$do_split_brain]); + runcmd @git, qw(checkout -q), (qw(master dgit-view)[!!do_split_brain()]); if (!open P, '>>', ".pc/applied-patches") { $!==&ENOENT or confess "$!"; @@ -6365,7 +6367,7 @@ sub build_or_push_prep_modes () { $do_split_brain = 1; } fail __ "dgit: --include-dirty is not supported in split view quilt mode" - if $do_split_brain && $includedirty; + if do_split_brain() && $includedirty; } sub build_prep_early () { @@ -6693,7 +6695,7 @@ sub build_source { unlink "$buildproductsdir/$sourcechanges" or $!==ENOENT or fail f_ "remove %s: %s", $sourcechanges, $!; } -# confess unless !!$made_split_brain == !!$do_split_brain; +# confess unless !!$made_split_brain == !!do_split_brain(); my @cmd = (@dpkgsource, qw(-b --)); my $leafdir;