Skip to content

Commit

Permalink
Fix merge_comments
Browse files Browse the repository at this point in the history
It wasn't keeping track of $lastsection correctly
  • Loading branch information
coolo committed Jan 28, 2021
1 parent f17d6cf commit fe55ab0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions prepare_spec
Expand Up @@ -1013,13 +1013,16 @@ EOF
my $lastsection;
for my $section (@{$self->{sections}}) {
if ($lastsection && $lastsection->name() eq 'comment') {
next if $lastsection->{after_lines} + $section->{before_lines};
$section->set_comment($lastsection);
$self->delete_section($lastsection);
return $self->merge_comments();
if ($lastsection->{after_lines} + $section->{before_lines} == 0) {

$section->set_comment($lastsection);
$self->delete_section($lastsection);
return $self->merge_comments();
}
}
$lastsection = $section;
}

}

sub merge_empty_sections {
Expand Down
4 changes: 2 additions & 2 deletions testing/url_https.spec.out
Expand Up @@ -53,17 +53,17 @@ URL: http://wrong.host.badssl.com/
%package null
Summary: Null cipher suite
URL: http://null.badssl.com/
# URL is FTP (issue#258)

# URL is FTP (issue#258)
%package ftp
Summary: Url is FTP
URL: ftp://ftp.null.badssl.com/

%package ftp1
Summary: Url is FTP
URL: ftp.null.badssl.com/
# other prefix

# other prefix
%package other
Summary: Url is not http, https or ftp
URL: abc://null.badssl.com/
Expand Down

0 comments on commit fe55ab0

Please sign in to comment.