git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] meson: wire up the git-subtree(1) command

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 17, 2025, 09:56 UTC
Message-ID
<20250117-b4-pks-build-subtree-v1-3-03c2ed6cc42e@pks.im>
In-Reply-To
<20250117-b4-pks-build-subtree-v1-0-03c2ed6cc42e@pks.im>

Wire up the git-subtree(1) command, which is part of "contrib/". Note that we have to move around the exact location where we include the "contrib/" subdirectory so that it comes after building the docs so that we have access to some of the common functionality.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/subtree/meson.build | 71 +++++++++++++++++++++++++++++++++++++++++++++
 meson.build                 |  3 +-
 2 files changed, 73 insertions(+), 1 deletion(-)
diff --git a/contrib/subtree/meson.build b/contrib/subtree/meson.build
new file mode 100644
index 0000000000..a752a188df
--- /dev/null
+++ b/contrib/subtree/meson.build
@@ -0,0 +1,71 @@
+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',
+)
+
+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,
+)
+
+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.txt',
+    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.txt',
+    output: 'git-subtree.html',
+    install: true,
+    install_dir: get_option('datadir') / 'doc/git-doc',
+  )
+endif
diff --git a/meson.build b/meson.build
index 0064eb64f5..ac7f6ef38b 100644
--- a/meson.build
+++ b/meson.build
@@ -1857,7 +1857,6 @@ endforeach
 if intl.found()
   subdir('po')
 endif
-subdir('contrib')
 
 # Gitweb requires Perl, so we disable the auto-feature if Perl was not found.
 # We make sure further up that Perl is required in case the gitweb option is
@@ -1884,6 +1883,8 @@ if get_option('docs') != []
   subdir('Documentation')
 endif
 
+subdir('contrib')
+
 foreach key, value : {
   'DIFF': diff.full_path(),
   'GIT_TEST_CMP': diff.full_path() + ' -u',
-- 
2.48.0.257.gd3603152ad.dirty
Previous: Patrick Steinhardt
Message 4 of 4 in “contrib/subtree: doc fixes and support for Meson”
  1. 0/3 contrib/subtree: doc fixes and support for MesonPatrick Steinhardt, Jan 17, 2025
  2. 2/3 meson: introduce build option for contribPatrick Steinhardt, Jan 17, 2025
  3. 1/3 contrib/subtree: fix building docsPatrick Steinhardt, Jan 17, 2025
  4. 3/3 meson: wire up the git-subtree(1) commandPatrick Steinhardt, Jan 17, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.