Meta/cook: carry section descriptions forward
Junio C Hamano committed
Sep 5, 2025 at 15:43 UTC
ce576f99c3d5046ea23380a8e2cdeed106665a1b
1 file changed
+15
cook
+15
index f717dbba07..93d6351306 100755
--- a/cook
+++ b/cook
@@ -452,6 +452,7 @@ sub read_previous {
my $branch = $blurb;
my $last_empty = undef;
my (@section, %section, @branch, %branch, %description, @leader);
+ my (%section_description);
my $in_unedited_olde = 0;
if (!-r $fn) {
@@ -500,6 +501,14 @@ sub read_previous {
}
next;
}
+ if (defined $section &&
+ !defined $branch &&
+ !/^\* /) {
+ $section_description{$section} ||= "";
+ $section_description{$section} .= "$_\n";
+ next;
+ }
+
if (defined $section && /^\* (\S+) /) {
$branch = $1;
$last_empty = 0;
@@ -565,6 +574,7 @@ sub read_previous {
section_list => \@section,
section_data => \%section,
topic_description => \%description,
+ section_description => \%section_description,
};
}
@@ -583,6 +593,11 @@ sub write_cooking {
print $fh '-' x 50, "\n";
print $fh "[$section_name]\n";
my $lead = "\n";
+
+ if ($cooking->{'section_description'}{$section_name}) {
+ print $fh "\n", $cooking->{'section_description'}{$section_name};
+ }
+
for my $topic (@{$topic_list}) {
my $d = $cooking->{'topic_description'}{$topic};