Files
git/contrib/subtree/meson.build
Patrick Steinhardt bdd04b91c3 meson: respect 'tests' build option in contrib
Both the "netrc" credential helper and git-subtree(1) from "contrib/"
carry a couple of tests with them. These tests get wired up in Meson
unconditionally even in the case where `-Dtests=false`. As those tests
depend on the `test_enviroment` variable, which only gets defined in
case `-Dtests=true`, the result is an error:

```
$ meson setup -Dtests=false -Dcontrib=subtree build
[...]

contrib/subtree/meson.build:15:27: ERROR: Unknown variable "test_environment".
```

Fix the issue by not defining these tests at all in case the "tests"
option is set to `false`.

Reported-by: Sam James <sam@gentoo.org>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-04-01 02:20:44 -07:00

74 lines
1.7 KiB
Meson

git_subtree = custom_target(
input: 'git-subtree.sh',
output: 'git-subtree',
command: [
shell,
meson.project_source_root() / 'generate-script.sh',
'@INPUT@',
'@OUTPUT@',
meson.project_build_root() / 'GIT-BUILD-OPTIONS',
],
install: true,
install_dir: get_option('libexecdir') / 'git-core',
)
if get_option('tests')
subtree_test_environment = test_environment
subtree_test_environment.prepend('PATH', meson.current_build_dir())
test('t7900-subtree', shell,
args: [ 't7900-subtree.sh' ],
env: subtree_test_environment,
workdir: meson.current_source_dir() / 't',
depends: test_dependencies + bin_wrappers + [ git_subtree ],
timeout: 0,
)
endif
if get_option('docs').contains('man')
subtree_xml = custom_target(
command: asciidoc_common_options + [
'--backend=' + asciidoc_docbook,
'--doctype=manpage',
'--out-file=@OUTPUT@',
'@INPUT@',
],
depends: documentation_deps,
input: 'git-subtree.adoc',
output: 'git-subtree.xml',
)
custom_target(
command: [
xmlto,
'-m', '@INPUT@',
'man',
subtree_xml,
'-o',
meson.current_build_dir(),
] + xmlto_extra,
input: [
'../../Documentation/manpage-normal.xsl',
],
output: 'git-subtree.1',
install: true,
install_dir: get_option('mandir') / 'man1',
)
endif
if get_option('docs').contains('html')
custom_target(
command: asciidoc_common_options + [
'--backend=' + asciidoc_html,
'--doctype=manpage',
'--out-file=@OUTPUT@',
'@INPUT@',
],
depends: documentation_deps,
input: 'git-subtree.adoc',
output: 'git-subtree.html',
install: true,
install_dir: get_option('datadir') / 'doc/git-doc',
)
endif