Skip to content

Commit 3dc6b4e

Browse files
szedergitster
authored andcommitted
Documentation/build-docdep.perl: generate sorted output
To make sure that our manpages are rebuilt when any of the included source files change and only the affected manpages are rebuilt, 'build-docdep.perl' scans our documentation source files for include directives, and outputs 'make' dependencies to be included by 'Documentation/Makefile'. This script relies on Perl's hash data structures, and generates its output while iterating over them, and since hashes in Perl are very much unordered, the output varies greatly from run to run, both the order of targets and the order of dependencies of each target. This lack of ordering doesn't matter for 'make', because it cares neither about the order of targets in a Makefile nor about the order of a target's dependencies. However, it does matter to developers looking into build issues potentially involving these generated dependencies, as it's rather hard to tell whether there are any relevant (i.e. not order-only) changes among the dependencies compared to the previous run. So let's make 'build-docdep.perl's output stable and ordered by sorting the keys of the hashes before iterating over them. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d5b4139 commit 3dc6b4e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Documentation/build-docdep.perl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@
3838
}
3939
}
4040

41-
while (my ($text, $included) = each %include) {
41+
foreach my $text (sort keys %include) {
42+
my $included = $include{$text};
4243
if (! exists $included{$text} &&
4344
(my $base = $text) =~ s/\.txt$//) {
44-
print "$base.html $base.xml : ", join(" ", keys %$included), "\n";
45+
print "$base.html $base.xml : ", join(" ", sort keys %$included), "\n";
4546
}
4647
}

0 commit comments

Comments
 (0)