Meta/cook: carry section descriptions forward
Junio C Hamano committed
Sep 5, 2025 at 15:43 UTC
ce576f99c3d5046ea23380a8e2cdeed106665a1b
1 file changed
+15
cook
+15
@@ -452,6 +452,7 @@ sub read_previous {
452
my $branch = $blurb;
453
my $last_empty = undef;
454
my (@section, %section, @branch, %branch, %description, @leader);
455
+ my (%section_description);
456
my $in_unedited_olde = 0;
457
458
if (!-r $fn) {
@@ -500,6 +501,14 @@ sub read_previous {
501
}
502
next;
503
}
504
+ if (defined $section &&
505
+ !defined $branch &&
506
+ !/^\* /) {
507
+ $section_description{$section} ||= "";
508
+ $section_description{$section} .= "$_\n";
509
+ next;
510
+ }
511
+
512
if (defined $section && /^\* (\S+) /) {
513
$branch = $1;
514
$last_empty = 0;
@@ -565,6 +574,7 @@ sub read_previous {
574
section_list => \@section,
575
section_data => \%section,
576
topic_description => \%description,
577
+ section_description => \%section_description,
578
};
579
}
580
@@ -583,6 +593,11 @@ sub write_cooking {
593
print $fh '-' x 50, "\n";
594
print $fh "[$section_name]\n";
595
my $lead = "\n";
596
+
597
+ if ($cooking->{'section_description'}{$section_name}) {
598
+ print $fh "\n", $cooking->{'section_description'}{$section_name};
599
+ }
600
+
601
for my $topic (@{$topic_list}) {
602
my $d = $cooking->{'topic_description'}{$topic};
603