git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Santi Béjar" <santi@agolina.net>
To: "Björn Hendriks" <bjoern01@nurfuerspam.de>
Cc: git@vger.kernel.org
Subject: Re: Generate version file by hooks
Date: Tue, 17 Mar 2009 16:43:31 +0100	[thread overview]
Message-ID: <adf1fd3d0903170843r3649eb53tf8b22240bbc20e33@mail.gmail.com> (raw)
In-Reply-To: <200903171626.01102.bjoern01@nurfuerspam.de>

2009/3/17 Björn Hendriks <bjoern01@nurfuerspam.de>:
>
> 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

  reply	other threads:[~2009-03-17 15:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-17 15:26 Generate version file by hooks Björn Hendriks
2009-03-17 15:43 ` Santi Béjar [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-03-17 15:42 John Dlugosz
2009-03-17 16:40 ` Björn Hendriks
2009-03-17 16:54   ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adf1fd3d0903170843r3649eb53tf8b22240bbc20e33@mail.gmail.com \
    --to=santi@agolina.net \
    --cc=bjoern01@nurfuerspam.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).