Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Martin Waitz <tali@admingilde.org>
Cc: Scott Lamb <slamb@slamb.org>, Junio C Hamano <junkio@cox.net>,
	git@vger.kernel.org, jonas.fonseca@gmail.com
Subject: Re: [PATCH] catch asciidoc failures
Date: Fri, 1 Jun 2007 05:10:30 -0400	[thread overview]
Message-ID: <20070601091030.GA2215@coredump.intra.peff.net> (raw)
In-Reply-To: <20070601083621.GB3521@admingilde.org>

On Fri, Jun 01, 2007 at 10:36:21AM +0200, Martin Waitz wrote:

> 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

  parent reply	other threads:[~2007-06-01  9:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-01  6:23 [PATCH] catch asciidoc failures Scott Lamb
2007-06-01  8:36 ` Martin Waitz
2007-06-01  8:55   ` Jonas Fonseca
2007-06-01  9:10   ` Jeff King [this message]
2007-06-01  9:39     ` Martin Waitz
2007-06-01  9:43       ` Jeff King
2007-06-01  9:46     ` Scott Lamb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070601091030.GA2215@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jonas.fonseca@gmail.com \
    --cc=junkio@cox.net \
    --cc=slamb@slamb.org \
    --cc=tali@admingilde.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox