summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2016-12-15 00:52:34 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2016-12-19 16:58:57 +0000
commit2d8ed57a73f0b8cc4ca31e60f85b24d4f6437075 (patch)
tree85edd5accf151cf54db221d593f849526894c9d3
parent41bb8ae608374db76795192819ec43caf815cf3f (diff)
dgit: Break out access_cfg_tagformats_can_splitbrain
While we're at it, use a hash %y rather than repeatedly grepping. No overall functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xdgit14
1 files changed, 10 insertions, 4 deletions
diff --git a/dgit b/dgit
index c280016..1a23d1a 100755
--- a/dgit
+++ b/dgit
@@ -1519,6 +1519,15 @@ sub access_cfg_tagformats () {
split /\,/, access_cfg('dgit-tag-format');
}
+sub access_cfg_tagformats_can_splitbrain () {
+ my %y = map { $_ => 1 } access_cfg_tagformats;
+ foreach my $needtf (qw(new maint)) {
+ next if $y{$needtf};
+ return 0;
+ }
+ return 1;
+}
+
sub need_tagformat ($$) {
my ($fmt, $why) = @_;
fail "need to use tag format $fmt ($why) but also need".
@@ -4912,13 +4921,10 @@ sub build_maybe_quilt_fixup () {
check_for_vendor_patches();
if (quiltmode_splitbrain) {
- foreach my $needtf (qw(new maint)) {
- next if grep { $_ eq $needtf } access_cfg_tagformats;
- fail <<END
+ fail <<END unless access_cfg_tagformats_can_splitbrain;
quilt mode $quilt_mode requires split view so server needs to support
both "new" and "maint" tag formats, but config says it doesn't.
END
- }
}
my $clogp = parsechangelog();