Documentation/build-docdep.perl: generate sorted output
commit3dc6b4e027266c7b7334920ca9be3162327325f7
authorSZEDER Gábor <szeder.dev@gmail.com>
Fri, 21 Oct 2022 10:29:50 +0000 (21 12:29 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Oct 2022 18:39:38 +0000 (21 11:39 -0700)
tree69e6862fdcc89164da4aef692d3322b35e28d693
parentd5b41391a472dcf9486055fd5b8517f893e88daf
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 <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/build-docdep.perl