Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/Documentation/build-docdep.perl # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / Documentation / build-docdep.perl` 49 lines ยท 1062 bytes Raw Blame History 1 #!/usr/bin/perl 2 3 my ($build_dir) = @ARGV; 4 my %include = (); 5 my %included = (); 6 7 for my $adoc (<*.adoc>) { 8 open I, '<', $adoc || die "cannot read: $adoc"; 9 while () { 10 if (/^include::/) { 11 chomp; 12 s/^include::\s*//; 13 s/\[\]//; 14 s/{build_dir}/${build_dir}/; 15 $include{$adoc}{$_} = 1; 16 $included{$_} = 1; 17 } 18 } 19 close I; 20 } 21 22 # Do we care about chained includes??? 23 my $changed = 1; 24 while ($changed) { 25 $changed = 0; 26 while (my ($adoc, $included) = each %include) { 27 for my $i (keys %$included) { 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{$adoc}{$j}) { 33 $include{$adoc}{$j} = 1; 34 $included{$j} = 1; 35 $changed = 1; 36 } 37 } 38 } 39 } 40 } 41 } 42 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 }