]> git.donarmstrong.com Git - debbugs.git/commitdiff
Only search for the first Format-Version: and use it text_xslate_templates
authorDon Armstrong <don@donarmstrong.com>
Fri, 23 Feb 2018 21:31:28 +0000 (13:31 -0800)
committerDon Armstrong <don@donarmstrong.com>
Fri, 23 Feb 2018 21:31:28 +0000 (13:31 -0800)
Avoid applying a regex to all lines of the format; find the first
Format-Version: and use it. [There should only ever be one Format-Version:
anyway.]

Debbugs/Status.pm

index 9b59045aa848164b8966b0e115ecc91bf1465434..2c6ce209e9c07dccbcde3335e0da25803c5dc544 100644 (file)
@@ -227,15 +227,19 @@ sub read_bug{
 
     my %data;
     my @lines;
-    my $version = 2;
+    my $version;
     local $_;
 
     while (<$status_fh>) {
         chomp;
         push @lines, $_;
-        $version = $1 if /^Format-Version: ([0-9]+)/i;
+       if (not defined $version and
+           /^Format-Version: ([0-9]+)/i
+          ) {
+           $version = $1;
+       }
     }
-
+    $version = 2 if not defined $version;
     # Version 3 is the latest format version currently supported.
     if ($version > 3) {
         warn "Unsupported status version '$version'";