Re: patch: version_stamp.pl: Add Git commit info to version if 'git' is specified - Mailing list pgsql-hackers

From Tom Lane
Subject Re: patch: version_stamp.pl: Add Git commit info to version if 'git' is specified
Date
Msg-id 4205.1440733611@sss.pgh.pa.us
Whole thread Raw
In response to patch: version_stamp.pl: Add Git commit info to version if 'git' is specified  (Øyvind A. Holm <sunny@sunbase.org>)
Responses Re: patch: version_stamp.pl: Add Git commit info to version if 'git' is specified  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
Øyvind A. Holm <sunny@sunbase.org> writes:
> this is a patch for src/tools/version_stamp.pl that adds the current Git 
> commit information from "git describe --tags --long" to the current 
> version string if "git" is specified on the command line.

Salesforce did something similar in their internal build, and TBH I do not
find it a good idea.  The basic problem is it's completely misleading to
equate the last commit with the source you actually built from, because
that might not have been an unmodified file set.  It's particularly a bad
idea to bind the data in as early as version_stamp.pl, which even precedes
autoconf let alone configure+build.  There are too many opportunities to
modify the source and then later think that what you built exactly matches
the stamped commit hash.  (In the Salesforce hack, we actually captured
the commit hash at the time of running configure, two steps later than you
have here --- but that's still too early to have any confidence that the
hash matches the built files.)

As a more concrete complaint: it's physically impossible for something
done this way to match an official git commit, let alone an official
tarball, because the commit hash you're starting from would have to
predate a commit of the files that version_stamp.pl stamps.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: patch: version_stamp.pl: Add Git commit info to version if 'git' is specified
Next
From: Tom Lane
Date:
Subject: Re: patch: version_stamp.pl: Add Git commit info to version if 'git' is specified