On Wed, Dec 28, 2016 at 09:09:04AM +0000, John P. Hartmann wrote: > The problem I am grappling with is how to obtain the latest git commit hash > and enter it into the generated code. Configure/make would appear to the > the time, but by then the user may not have git installed (e.g., extracted > the project as .zip from github), so it needs to be done "back at the farm". > > I hear that the best I can do is create a normal script in the repro and add > to the developer handbook that "btw, here is a git hook that will run it > automatically if you so choose". Yes, if you want the information to be conveyed in a .zip from GitHub, then you'll have to commit the value to the repository. For example, the script in Git itself looks like this: https://github.com/git/git/blob/master/GIT-VERSION-GEN We pull the value from the Git repository if we have one, then fallback to a .version file which is generated when release tarballs are generated, and then finally fall back to a baked-in DEF_VER variable that is updated manually after each release (and that last is what you'd get if you had, say, a .zip file from GitHub). I'm not sure you would want to update that DEF_VER for _every_ commit, though, even if you could do so with a hook. It would mean every commit would update the version field. And of course it could not have the git commit id, because that is generated from a hash of the contents that includes the contents of that version field. If you're mostly interested in building straight from GitHub .zip files, those do include the commit id (or tag name) in the directory name, so your Makefile could deduce it at runtime from that information. -Peff