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

Re: Generate version file by hooks

From
SBSanti Béjar <santi@agolina.net>
Date
Mar 17, 2009, 15:43 UTC
Message-ID
<adf1fd3d0903170843r3649eb53tf8b22240bbc20e33@mail.gmail.com>
In-Reply-To
<200903171626.01102.bjoern01@nurfuerspam.de>
2009/3/17 Björn Hendriks <bjoern01@nurfuerspam.de>:
Show 5 quoted lines
>
> Hello,
>
> I'd like to put the SHA1 of the current commit into a source file so that my
> program can further process it -- put it into a log file for example.

You can look at what is done in git itself with the version number. There is a GIT-VERSION-GEN that generates a GIT-VERSION-FILE with the version number (it only updates the file if the version number has changed). Then in the makefile you specify how to create it and which programs depend on the GIT-VERSION-FILE:

GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
        @$(SHELL_PATH) ./GIT-VERSION-GEN
-include GIT-VERSION-FILE
program: GIT-VERSION-FILE

HTH, Santi

Previous: Björn Hendriks
Message 2 of 2 in “Generate version file by hooks”
  1. Björn HendriksMar 17, 2009
  2. Santi BéjarMar 17, 2009

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.