doc: fix build-docdep.perl

We renamed from .txt to .adoc all the asciidoc source files and necessary includes. We also need to adjust the build-docdep tool to work on files whose suffix is .adoc when computing the documentation dependencies. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Mar 1, 2025 at 10:25 UTC 06d9252bccc39c335fa5ab36adf724df4570248c
1 file changed +12 -12
Documentation/build-docdep.perl
+12 -12
@@ -4,15 +4,15 @@ my ($build_dir) = @ARGV;
4 my %include = ();
5 my %included = ();
6
7 -for my $text (<*.txt>) {
8 - open I, '<', $text || die "cannot read: $text";
7 +for my $adoc (<*.adoc>) {
8 + open I, '<', $adoc || die "cannot read: $adoc";
9 while (<I>) {
10 if (/^include::/) {
11 chomp;
12 s/^include::\s*//;
13 s/\[\]//;
14 s/{build_dir}/${build_dir}/;
15 - $include{$text}{$_} = 1;
15 + $include{$adoc}{$_} = 1;
16 $included{$_} = 1;
17 }
18 }
@@ -23,14 +23,14 @@ for my $text (<*.txt>) {
23 my $changed = 1;
24 while ($changed) {
25 $changed = 0;
26 - while (my ($text, $included) = each %include) {
26 + while (my ($adoc, $included) = each %include) {
27 for my $i (keys %$included) {
28 - # $text has include::$i; if $i includes $j
29 - # $text indirectly includes $j.
28 + # $adoc has include::$i; if $i includes $j
29 + # $adoc indirectly includes $j.
30 if (exists $include{$i}) {
31 for my $j (keys %{$include{$i}}) {
32 - if (!exists $include{$text}{$j}) {
33 - $include{$text}{$j} = 1;
32 + if (!exists $include{$adoc}{$j}) {
33 + $include{$adoc}{$j} = 1;
34 $included{$j} = 1;
35 $changed = 1;
36 }
@@ -40,10 +40,10 @@ while ($changed) {
40 }
41 }
42
43 -foreach my $text (sort keys %include) {
44 - my $included = $include{$text};
45 - if (! exists $included{$text} &&
46 - (my $base = $text) =~ s/\.txt$//) {
43 +foreach my $adoc (sort keys %include) {
44 + my $included = $include{$adoc};
45 + if (! exists $included{$adoc} &&
46 + (my $base = $adoc) =~ s/\.adoc$//) {
47 print "$base.html $base.xml : ", join(" ", sort keys %$included), "\n";
48 }
49 }