Subject: Re: [PATCH] Documentation/Makefile: don't re-build on 'git version' changes

From: Felipe Contreras <[email-masked]>
Date: Sat, 03 Jul 2021 13:56:50 -0500

Ævar Arnfjörð Bjarmason wrote:
> 
> On Fri, Jul 02 2021, Felipe Contreras wrote:
> 
> > Ævar Arnfjörð Bjarmason wrote:
> >> Since 9a71722b4df (Doc: auto-detect changed build flags, 2019-03-17)
> >> we've been eagerly re-building the documentation whenever the output
> >> of "git version" (via the GIT-VERSION file) changed. This was never
> >> the intention, and was a regression on what we intended in
> >> 7b8a74f39cb (Documentation: Replace @@GIT_VERSION@@ in documentation,
> >> 2007-03-25).
> >> 
> >> So let's add an ASCIIDOC_MANVERSION variable that we exclude from
> >> ASCIIDOC_COMMON. The change in 9a71722b4df was only intending to catch
> >> cases where we e.g. switched between asciidoc and asciidoctor, not to
> >> undo the logic in 7b8a74f39cb and force a re-build every time our HEAD
> >> changed in the repository.
> >
> > Once again, why do we care that the version is 2.32.0.98.gcfb60a24d6 and
> > not 2.32.0.97.g949e814b27?
> >
> > Not just in the documentation, but everywhere.
> 
> It's useful e.g. on my Debian system to see that the "next" Debian
> packaged is 2.31.0.291.g576ba9dcdaf in docs & "git version", arguably
> less so for documentation.

Obviously packagers would use real versions I meant this only for
developers (e.g. DEVELOPER=1).

And BTW, where is that Debian package coming from? I thought
distributions didn't package git pre-releases.

> > Maybe we can add a GIT_RELEASE variable that unlike GIT_VERSION it
> > doesn't contain the precise commit. For example GIT_RELEASE = 2.33-dev.
> 
> I just added this to my pre-make script:
> 
> 	grep -q ^/version .git/info/exclude || echo /version >>.git/info/exclude
> 	echo $(grep -o -P '(?<=^DEF_VER=v).*' GIT-VERSION-GEN)-dev >version
> 
> It makes use of GIT-VERSION-GEN picking up a tarball "version" file.

This would also do the trick (you need DEVELOPER on the environment
though).

--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -6,9 +6,10 @@ DEF_VER=v2.32.0
 LF='
 '
 
-# First see if there is a version file (included in release tarballs),
-# then try git-describe, then default.
-if test -f version
+if test -n "$DEVELOPER"
+then
+       VN="$DEF_VER"-dev
+elif test -f version
 then
        VN=$(cat version) || VN="$DEF_VER"
 elif test -d ${GIT_DIR:-.git} -o -f .git &&

-- 
Felipe Contreras