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

Re: [PATCH] catch asciidoc failures

From
Jeff King <peff@peff.net>
Date
Jun 1, 2007, 09:10 UTC
Message-ID
<20070601091030.GA2215@coredump.intra.peff.net>
In-Reply-To
<20070601083621.GB3521@admingilde.org>
On Fri, Jun 01, 2007 at 10:36:21AM +0200, Martin Waitz wrote:
Show 7 quoted lines
> perhaps we should simply change the pipe ordering to get asciidoc
> to the end of the pipeline so that all shells respect its exit code?
> [...]
> something like (untested):
> 	sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' $< |
> 		$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
> 			$(ASCIIDOC_EXTRA) -o $@+ -

That won't work. The text @@GIT_VERSION@@ is pulled in from the asciidoc.conf file, so it's not even in the source file; it's only in the built product.

As Jonas suggested, making it an asciidoc attribute is much more elegant (patch even tested!):

-- >8 --
Documentation: robustify asciidoc GIT_VERSION replacement

Instead of using sed on the resulting file, we now have a git_version asciidoc attribute. This means that we don't pipe the output of asciidoc, which means we can detect build failures.

Problem reported by Scott Lamb, solution suggested by Jonas Fonseca.
Signed-off-by: Jeff King <peff@peff.net>
---
 Documentation/Makefile      |    6 ++----
 Documentation/asciidoc.conf |    2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 3f92783..4064b38 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -112,8 +112,7 @@ clean:
 %.html : %.txt
 	rm -f $@+ $@
 	$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
-		$(ASCIIDOC_EXTRA) -o - $< | \
-		sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' >$@+
+		$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
 	mv $@+ $@
 
 %.1 %.5 %.7 : %.xml
@@ -122,8 +121,7 @@ clean:
 %.xml : %.txt
 	rm -f $@+ $@
 	$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
-		$(ASCIIDOC_EXTRA) -o - $< | \
-		sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' >$@+
+		$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
 	mv $@+ $@
 
 user-manual.xml: user-manual.txt user-manual.conf
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf
index fa7dc94..60e15ba 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf
@@ -40,7 +40,7 @@ template::[header-declarations]
 <refentrytitle>{mantitle}</refentrytitle>
 <manvolnum>{manvolnum}</manvolnum>
 <refmiscinfo class="source">Git</refmiscinfo>
-<refmiscinfo class="version">@@GIT_VERSION@@</refmiscinfo>
+<refmiscinfo class="version">{git_version}</refmiscinfo>
 <refmiscinfo class="manual">Git Manual</refmiscinfo>
 </refmeta>
 <refnamediv>
-- 
1.5.2.871.g0ff23
Previous: Jonas FonsecaNext: Martin Waitz
Message 4 of 7 in “catch asciidoc failures”
  1. catch asciidoc failuresScott Lamb, Jun 1, 2007
  2. Martin WaitzJun 1, 2007
  3. Jonas FonsecaJun 1, 2007
  4. Jeff KingJun 1, 2007
  5. Martin WaitzJun 1, 2007
  6. Jeff KingJun 1, 2007
  7. Scott LambJun 1, 2007

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.