]> git.ipfire.org Git - thirdparty/git.git/commit
Documentation: allow sourcing generated includes from separate dir
authorPatrick Steinhardt <ps@pks.im>
Fri, 6 Dec 2024 13:24:53 +0000 (14:24 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Dec 2024 22:52:12 +0000 (07:52 +0900)
commit9219325be74c35c493a61ab3107d215cad91cf38
tree77a9a7f1a25d54c264b879963767077589d75126
parented060aa0a35f5d0e201af45c6a32c405db4c2654
Documentation: allow sourcing generated includes from separate dir

Our documentation uses "include::" directives to include parts that are
either reused across multiple documents or parts that we generate at
build time. Unfortunately, top-level includes are only ever resolved
relative to the base directory, which is typically the directory of the
including document. Most importantly, it is not possible to have either
asciidoc or asciidoctor search multiple directories.

It follows that both kinds of includes must live in the same directory.
This is of course a bummer for out-of-tree builds, because here the
dynamically-built includes live in the build directory whereas the
static includes live in the source directory.

Introduce a `build_dir` attribute and prepend it to all of our includes
for dynamically-built files. This attribute gets set to the build
directory and thus converts the include path to an absolute path, which
asciidoc and asciidoctor know how to resolve.

Note that this change also requires us to update "build-docdep.perl",
which tries to figure out included files such our Makefile can set up
proper build-time dependencies. This script simply scans through the
source files for any lines that match "^include::" and treats the
remainder of the line as included file path. But given that those may
now contain the "{build_dir}" variable we have to teach the script to
replace that attribute with the actual build directory.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/Makefile
Documentation/build-docdep.perl
Documentation/config/diff.txt
Documentation/config/merge.txt
Documentation/git.txt