{"thread":{"id":"62822","subject":"[PATCH 0/3] contrib/subtree: doc fixes and support for Meson","startedAt":"2025-01-17T09:56:19Z","lastAt":"2025-01-17T09:56:21Z","messageCount":4,"participants":["Patrick Steinhardt"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"510781","messageId":"20250117-b4-pks-build-subtree-v1-0-03c2ed6cc42e@pks.im","threadId":"62822","inReplyTo":null,"subject":"[PATCH 0/3] contrib/subtree: doc fixes and support for Meson","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-01-17T09:56:04Z","receivedAt":"2025-01-17T09:56:19Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Hi,\n\nthis patch series fixes a broken build of documentation in\n\"contrib/subtree\". While at it it also wires up support for the Meson\nbuild system.\n\nThanks!\n\nPatrick\n\n---\nPatrick Steinhardt (3):\n      contrib/subtree: fix building docs\n      meson: introduce build option for contrib\n      meson: wire up the git-subtree(1) command\n\n contrib/meson.build         |  4 ++-\n contrib/subtree/.gitignore  |  2 ++\n contrib/subtree/Makefile    | 23 ++++++++++-----\n contrib/subtree/meson.build | 71 +++++++++++++++++++++++++++++++++++++++++++++\n meson.build                 |  3 +-\n meson_options.txt           |  2 ++\n 6 files changed, 95 insertions(+), 10 deletions(-)\n\n\n---\nbase-commit: 757161efcca150a9a96b312d9e780a071e601a03\nchange-id: 20250117-b4-pks-build-subtree-17f91144340f\n\n"},{"id":"510782","messageId":"20250117-b4-pks-build-subtree-v1-2-03c2ed6cc42e@pks.im","threadId":"62822","inReplyTo":"20250117-b4-pks-build-subtree-v1-0-03c2ed6cc42e@pks.im","subject":"[PATCH 2/3] meson: introduce build option for contrib","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-01-17T09:56:06Z","receivedAt":"2025-01-17T09:56:20Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"We unconditionally wire up building command completion present in the\n\"contrib/\" directory. This may or may not be what users want, and we\ndon't provide a way to disable it.\n\nIntroduce a new \"contrib\" build option. This option is introduced as an\narray so that users can manually pick which exact features they want to\ninclude from the \"contrib\" directory. By default, we build and install\nshell completions, which is a commonly used feature and also the current\ndefault.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n contrib/meson.build | 4 +++-\n meson_options.txt   | 2 ++\n 2 files changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/meson.build b/contrib/meson.build\nindex a7b77b87c2..d74b64a518 100644\n--- a/contrib/meson.build\n+++ b/contrib/meson.build\n@@ -1 +1,3 @@\n-subdir('completion')\n+foreach feature : get_option('contrib')\n+  subdir(feature)\n+endforeach\ndiff --git a/meson_options.txt b/meson_options.txt\nindex f50bb40cdf..4f02c92524 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -27,6 +27,8 @@ option('version', type: 'string', value: '',\n   description: 'Version string reported by git-version(1) and other tools.')\n \n # Features supported by Git.\n+option('contrib', type: 'array', value: [ 'completion' ], choices: [ 'completion', 'subtree' ],\n+  description: 'Contributed features to include.')\n option('curl', type: 'feature', value: 'enabled',\n   description: 'Build helpers used to access remotes with the HTTP transport.')\n option('expat', type: 'feature', value: 'enabled',\n\n-- \n2.48.0.257.gd3603152ad.dirty\n\n"},{"id":"510783","messageId":"20250117-b4-pks-build-subtree-v1-1-03c2ed6cc42e@pks.im","threadId":"62822","inReplyTo":"20250117-b4-pks-build-subtree-v1-0-03c2ed6cc42e@pks.im","subject":"[PATCH 1/3] contrib/subtree: fix building docs","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-01-17T09:56:05Z","receivedAt":"2025-01-17T09:56:20Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In a38edab7c8 (Makefile: generate doc versions via GIT-VERSION-GEN,\n2024-12-06), we have refactored how we build our documentation by\ninjecting the Git version into the Asciidoc and AsciiDoctor config\nfiles instead of doing so via arguments. As such, the original config\nfiles were removed, where the expectation is that they get generated via\n`GIT-VERSION-GEN` now.\n\nWhie the git-subtree(1) command part of \"contrib/\" also builds docs\nusing these same config files, its Makefile wasn't adjusted accordingly\nand thus building the docs is broken.\n\nFix this by using `GIT-VERSION-GEN` to generate those files.\n\nReported-by: Renato Botelho <garga@FreeBSD.org>\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n contrib/subtree/.gitignore |  2 ++\n contrib/subtree/Makefile   | 23 +++++++++++++++--------\n 2 files changed, 17 insertions(+), 8 deletions(-)\n\ndiff --git a/contrib/subtree/.gitignore b/contrib/subtree/.gitignore\nindex 0b9381abca..6deaf177c7 100644\n--- a/contrib/subtree/.gitignore\n+++ b/contrib/subtree/.gitignore\n@@ -1,4 +1,6 @@\n *~\n+asciidoc.conf\n+asciidoctor-extensions.rb\n git-subtree\n git-subtree.1\n git-subtree.html\ndiff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile\nindex 6fa7496bfd..8fe0bfd401 100644\n--- a/contrib/subtree/Makefile\n+++ b/contrib/subtree/Makefile\n@@ -1,6 +1,7 @@\n # The default target of this Makefile is...\n all::\n \n+-include ../../shared.mak\n -include ../../config.mak.autogen\n -include ../../config.mak\n \n@@ -13,17 +14,16 @@ htmldir ?= $(prefix)/share/doc/git-doc\n ../../GIT-VERSION-FILE: FORCE\n \t$(MAKE) -C ../../ GIT-VERSION-FILE\n \n--include ../../GIT-VERSION-FILE\n-\n # this should be set to a 'standard' bsd-type install program\n INSTALL  ?= install\n RM       ?= rm -f\n \n ASCIIDOC         = asciidoc\n-ASCIIDOC_CONF    = -f ../../Documentation/asciidoc.conf\n+ASCIIDOC_CONF    = -f asciidoc.conf\n ASCIIDOC_HTML    = xhtml11\n ASCIIDOC_DOCBOOK = docbook\n ASCIIDOC_EXTRA   =\n+ASCIIDOC_DEPS    = asciidoc.conf\n XMLTO            = xmlto\n XMLTO_EXTRA      =\n \n@@ -32,8 +32,9 @@ ASCIIDOC         = asciidoctor\n ASCIIDOC_CONF    =\n ASCIIDOC_HTML    = xhtml5\n ASCIIDOC_DOCBOOK = docbook\n-ASCIIDOC_EXTRA  += -I../../Documentation -rasciidoctor-extensions\n+ASCIIDOC_EXTRA  += -I. -rasciidoctor-extensions\n ASCIIDOC_EXTRA  += -alitdd='&\\#x2d;&\\#x2d;'\n+ASCIIDOC_DEPS    = asciidoctor-extensions.rb\n XMLTO_EXTRA     += --skip-validation\n endif\n \n@@ -82,13 +83,13 @@ install-html: $(GIT_SUBTREE_HTML)\n $(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)\n \t$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $^\n \n-$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)\n+$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT) $(ASCIIDOC_DEPS)\n \t$(ASCIIDOC) -b $(ASCIIDOC_DOCBOOK) -d manpage $(ASCIIDOC_CONF) \\\n-\t\t-agit_version=$(GIT_VERSION) $(ASCIIDOC_EXTRA) $^\n+\t\t$(ASCIIDOC_EXTRA) $<\n \n-$(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT)\n+$(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT) $(ASCIIDOC_DEPS)\n \t$(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage $(ASCIIDOC_CONF) \\\n-\t\t-agit_version=$(GIT_VERSION) $(ASCIIDOC_EXTRA) $^\n+\t\t$(ASCIIDOC_EXTRA) $<\n \n $(GIT_SUBTREE_TEST): $(GIT_SUBTREE)\n \tcp $< $@\n@@ -98,6 +99,12 @@ test: $(GIT_SUBTREE_TEST)\n \n clean:\n \t$(RM) $(GIT_SUBTREE)\n+\t$(RM) asciidoc.conf asciidoctor-extensions.rb\n \t$(RM) *.xml *.html *.1\n \n+asciidoc.conf: ../../Documentation/asciidoc.conf.in ../../GIT-VERSION-FILE\n+\t$(QUIET_GEN)$(call version_gen,\"$(shell pwd)/../..\",$<,$@)\n+asciidoctor-extensions.rb: ../../Documentation/asciidoctor-extensions.rb.in ../../GIT-VERSION-FILE\n+\t$(QUIET_GEN)$(call version_gen,\"$(shell pwd)/../..\",$<,$@)\n+\n .PHONY: FORCE\n\n-- \n2.48.0.257.gd3603152ad.dirty\n\n"},{"id":"510784","messageId":"20250117-b4-pks-build-subtree-v1-3-03c2ed6cc42e@pks.im","threadId":"62822","inReplyTo":"20250117-b4-pks-build-subtree-v1-0-03c2ed6cc42e@pks.im","subject":"[PATCH 3/3] meson: wire up the git-subtree(1) command","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-01-17T09:56:07Z","receivedAt":"2025-01-17T09:56:21Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Wire up the git-subtree(1) command, which is part of \"contrib/\". Note\nthat we have to move around the exact location where we include the\n\"contrib/\" subdirectory so that it comes after building the docs so that\nwe have access to some of the common functionality.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n contrib/subtree/meson.build | 71 +++++++++++++++++++++++++++++++++++++++++++++\n meson.build                 |  3 +-\n 2 files changed, 73 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/meson.build b/contrib/subtree/meson.build\nnew file mode 100644\nindex 0000000000..a752a188df\n--- /dev/null\n+++ b/contrib/subtree/meson.build\n@@ -0,0 +1,71 @@\n+git_subtree = custom_target(\n+  input: 'git-subtree.sh',\n+  output: 'git-subtree',\n+  command: [\n+    shell,\n+    meson.project_source_root() / 'generate-script.sh',\n+    '@INPUT@',\n+    '@OUTPUT@',\n+    meson.project_build_root() / 'GIT-BUILD-OPTIONS',\n+  ],\n+  install: true,\n+  install_dir: get_option('libexecdir') / 'git-core',\n+)\n+\n+subtree_test_environment = test_environment\n+subtree_test_environment.prepend('PATH', meson.current_build_dir())\n+\n+test('t7900-subtree', shell,\n+  args: [ 't7900-subtree.sh' ],\n+  env: subtree_test_environment,\n+  workdir: meson.current_source_dir() / 't',\n+  depends: test_dependencies + bin_wrappers + [ git_subtree ],\n+  timeout: 0,\n+)\n+\n+if get_option('docs').contains('man')\n+  subtree_xml = custom_target(\n+    command: asciidoc_common_options + [\n+      '--backend=' + asciidoc_docbook,\n+      '--doctype=manpage',\n+      '--out-file=@OUTPUT@',\n+      '@INPUT@',\n+    ],\n+    depends: documentation_deps,\n+    input: 'git-subtree.txt',\n+    output: 'git-subtree.xml',\n+  )\n+\n+  custom_target(\n+    command: [\n+      xmlto,\n+      '-m', '@INPUT@',\n+      'man',\n+      subtree_xml,\n+      '-o',\n+      meson.current_build_dir(),\n+    ] + xmlto_extra,\n+    input: [\n+      '../../Documentation/manpage-normal.xsl',\n+    ],\n+    output: 'git-subtree.1',\n+    install: true,\n+    install_dir: get_option('mandir') / 'man1',\n+  )\n+endif\n+\n+if get_option('docs').contains('html')\n+  custom_target(\n+    command: asciidoc_common_options + [\n+      '--backend=' + asciidoc_html,\n+      '--doctype=manpage',\n+      '--out-file=@OUTPUT@',\n+      '@INPUT@',\n+    ],\n+    depends: documentation_deps,\n+    input: 'git-subtree.txt',\n+    output: 'git-subtree.html',\n+    install: true,\n+    install_dir: get_option('datadir') / 'doc/git-doc',\n+  )\n+endif\ndiff --git a/meson.build b/meson.build\nindex 0064eb64f5..ac7f6ef38b 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1857,7 +1857,6 @@ endforeach\n if intl.found()\n   subdir('po')\n endif\n-subdir('contrib')\n \n # Gitweb requires Perl, so we disable the auto-feature if Perl was not found.\n # We make sure further up that Perl is required in case the gitweb option is\n@@ -1884,6 +1883,8 @@ if get_option('docs') != []\n   subdir('Documentation')\n endif\n \n+subdir('contrib')\n+\n foreach key, value : {\n   'DIFF': diff.full_path(),\n   'GIT_TEST_CMP': diff.full_path() + ' -u',\n\n-- \n2.48.0.257.gd3603152ad.dirty\n\n"}]}