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

Re: Generate version file by hooks

From
BHBjörn Hendriks <bjoern01@nurfuerspam.de>
Date
Mar 17, 2009, 16:40 UTC
Message-ID
<200903171740.26575.bjoern01@nurfuerspam.de>
In-Reply-To
<450196A1AAAE4B42A00A8B27A59278E70A2AF280@EXCHANGE.trad.tradestation.com>
Hi John, hi Santi,
thanks for your help.
On Dienstag 17 März 2009 16:42:01 John Dlugosz wrote:
Show 5 quoted lines
> Isn't that what the existing file HEAD is for?  Possibly with a level of
> indirection.  So use
> 	git rev-parse HEAD
> any time you need that SHA1 value.  The HEAD is always updated, since
> that _is_ what defines the "current" commit.

That might be a good alternative to my call of git-log which I was not absolutely sure if it works under all circumstances.

In fact my problem is not to find out the SHA1 of the last commit in a script but to have that script called automatically each time git changes the commit. My idea was to use the git hooks for that, but as I explained I couldn't find hooks for all cases in which a commit changes.

I need git to do that because my application is a Matlab-project which I normally do not compile -- although there is a Matlab-compiler to get a standalone application, but within the Matlab environment you don't need to compile. It would be the same with my little bash-helper-scripts I manage also with the great assistance of git.

But now -- as I think of it -- I might as well put a script call into the Matlab-code to get the last SHA1 and find a different solution for the rare cases in which I really compile the Matlab-code.

Thanks Björn

Previous: John DlugoszNext: Johannes Sixt
Message 2 of 3 in “Re: Generate version file by hooks”
  1. John DlugoszMar 17, 2009
  2. Björn HendriksMar 17, 2009
  3. Johannes SixtMar 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.