From 298805c823067ca32b1577662c87f77240e36aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C3=85gren?= Date: Sat, 21 Dec 2024 00:18:16 +0100 Subject: [PATCH 1/3] asciidoctor-extensions.rb.in: delete existing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the recent a38edab7c8 (Makefile: generate doc versions via GIT-VERSION-GEN, 2024-12-06), building with Asciidoctor results in manpages where the headers no longer contain "Git Manual" and the footers no longer identify the built Git version. Before a38edab7c8, we used to just provide a few attributes to Asciidoctor (and asciidoc). Commit 7a30134358 (asciidoctor-extensions: provide ``, 2019-09-16) noted that older versions of Asciidoctor didn't propagate those attributes into the built XML files, so we started injecting them ourselves from this script. With newer versions of Asciidoctor, we'd end up with some harmless duplication among the tags in the final XML. Post-a38edab7c8, we don't provide these attributes and Asciidoctor inserts empty-ish values. After our additions from 7a30134358, we get     2.47.1.[...] Git Manual When these are handled, it appears to be first come first served, meaning that our additions have no effect and we regress as described in the first paragraph. Remove existing "source" or "manual" tags before adding ours. I considered removing all to get a nice clean slate, instead of just those two that we want to replace to be a bit more precise. I opted for the latter. Maybe one day, Asciidoctor learns to insert something useful there which `xmlto` can pick up and make good use of -- let's not interfere. Signed-off-by: Martin Ågren Signed-off-by: Junio C Hamano --- Documentation/asciidoctor-extensions.rb.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/asciidoctor-extensions.rb.in b/Documentation/asciidoctor-extensions.rb.in index c4c200dace..d8d06f9a57 100644 --- a/Documentation/asciidoctor-extensions.rb.in +++ b/Documentation/asciidoctor-extensions.rb.in @@ -29,6 +29,8 @@ module Git class DocumentPostProcessor < Asciidoctor::Extensions::Postprocessor def process document, output if document.basebackend? 'docbook' + output = output.sub(/.*?<\/refmiscinfo>/, "") + output = output.sub(/.*?<\/refmiscinfo>/, "") new_tags = "" \ "@GIT_VERSION@\n" \ "Git Manual\n" From c683924d06e3c1f0166054450d4a7ecbabca0756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C3=85gren?= Date: Sat, 21 Dec 2024 00:18:17 +0100 Subject: [PATCH 2/3] asciidoctor-extensions.rb.in: add missing word MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit a38edab7c8 (Makefile: generate doc versions via GIT-VERSION-GEN, 2024-12-06) stopped providing an attribute value "Git $(GIT_VERSION)" to asciidoc/Asciidoctor over the command line. Instead, we now provide the attribute to asciidoc through a generated asciidoc.conf, where the value is generated as "Git @GIT_VERSION@". In the similar mechanism for Asciidoctor, we forgot the "Git" prefix. Restore it. Signed-off-by: Martin Ågren Signed-off-by: Junio C Hamano --- Documentation/asciidoctor-extensions.rb.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/asciidoctor-extensions.rb.in b/Documentation/asciidoctor-extensions.rb.in index d8d06f9a57..fd1b84c2be 100644 --- a/Documentation/asciidoctor-extensions.rb.in +++ b/Documentation/asciidoctor-extensions.rb.in @@ -32,7 +32,7 @@ module Git output = output.sub(/.*?<\/refmiscinfo>/, "") output = output.sub(/.*?<\/refmiscinfo>/, "") new_tags = "" \ - "@GIT_VERSION@\n" \ + "Git @GIT_VERSION@\n" \ "Git Manual\n" output = output.sub(/<\/refmeta>/, new_tags + "") end From beb8081f3153fe17907131b94b4c7d32167ff26d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C3=85gren?= Date: Sat, 21 Dec 2024 00:18:18 +0100 Subject: [PATCH 3/3] asciidoctor-extensions.rb.in: inject GIT_DATE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After a38edab7c8 (Makefile: generate doc versions via GIT-VERSION-GEN, 2024-12-06), we no longer inject GIT_DATE when building with Asciidoctor. Replace the tag in the XML to inject the value of GIT_DATE. Unlike as handled in a recent commit, we have no reason to expect that this tag might be missing, so there's no need for "maybe remove, then add" and we can just outright replace the one that Asciidoctor has generated based on the mtime of the source file. Compared to pre-a38edab7c8, we now end up injecting this also in the build of Git.3pm, which until now has been using the mtime of Git.pm. That is arguably even a good change since it results in more reproducible builds. Signed-off-by: Martin Ågren Signed-off-by: Junio C Hamano --- Documentation/asciidoctor-extensions.rb.in | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/asciidoctor-extensions.rb.in b/Documentation/asciidoctor-extensions.rb.in index fd1b84c2be..2494f17a51 100644 --- a/Documentation/asciidoctor-extensions.rb.in +++ b/Documentation/asciidoctor-extensions.rb.in @@ -31,6 +31,7 @@ module Git if document.basebackend? 'docbook' output = output.sub(/.*?<\/refmiscinfo>/, "") output = output.sub(/.*?<\/refmiscinfo>/, "") + output = output.sub(/.*?<\/date>/, "@GIT_DATE@") new_tags = "" \ "Git @GIT_VERSION@\n" \ "Git Manual\n"