Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #144233

Re: Tagging programs with git hash. [slightly OT]

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Tagging programs with git hash. [slightly OT]
Date Fri, 31 May 2019 13:23:04 -0700
Organization None to speak of
Lines 21
Message-ID <ln5zpqqspj.fsf@kst-u.example.com> (permalink)
References <dc2a28eb-b00b-4151-b7de-ede01ab3d373@googlegroups.com> <a937a32e-df93-48b3-9c23-b10eab33b5e4@trust.no1> <5cf1598a$0$6484$426a74cc@news.free.fr>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info reader02.eternal-september.org; posting-host="75605edc6d5df8cff0a246a2f96c1385"; logging-data="4730"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18/5QuZ5IfSf2D/EV3emX0T"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:mBWuPODkMRZ4dTU+YhWYfzXDIjQ= sha1:4ThONafg3LGRPphAjXLzfR80F8Q=
Xref csiph.com comp.lang.c:144233

Show key headers only | View raw


Mateusz Viste <mateusz@wont.tell> writes:
> On Fri, 31 May 2019 14:27:18 +0000, Queequeg wrote:
>> Fetch the current commit hash during compilation (for example with git
>> rev-parse --short HEAD) and put it in a macrodefinition in your makefile
>> or similar.
>> 
>> CFLAGS += -DCOMMIT_HASH=\"$(shell git rev-parse --short HEAD)\"
>
> This has the ugly drawback that the build process breaks as soon as 
> there's no git involved - like distributing the source code in a 
> standalone *.tar.gz or so.

Then whatever (a script, a "make tarball" target, etc.) creates
the *.tar.gz file can run the appropriate git command and write its
output to a file.  The Makefile can invoke something that invokes
git and falls back to reading that file if the git command fails.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Tagging programs with git hash. [slightly OT] Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-05-31 07:02 -0700
  Re: Tagging programs with git hash. [slightly OT] queequeg@trust.no1 (Queequeg) - 2019-05-31 14:27 +0000
    Re: Tagging programs with git hash. [slightly OT] Mateusz Viste <mateusz@wont.tell> - 2019-05-31 16:42 +0000
      Re: Tagging programs with git hash. [slightly OT] Keith Thompson <kst-u@mib.org> - 2019-05-31 13:23 -0700
      Re: Tagging programs with git hash. [slightly OT] queequeg@trust.no1 (Queequeg) - 2019-05-31 21:10 +0000
        Re: Tagging programs with git hash. [slightly OT] Mateusz Viste <mateusz@wont.tell> - 2019-06-01 09:31 +0000
          Re: Tagging programs with git hash. [slightly OT] queequeg@trust.no1 (Queequeg) - 2019-06-01 12:39 +0000
  Re: Tagging programs with git hash. [slightly OT] David Brown <david.brown@hesbynett.no> - 2019-05-31 16:28 +0200
  Re: Tagging programs with git hash. [slightly OT] fir <profesor.fir@gmail.com> - 2019-05-31 07:51 -0700
  Re: Tagging programs with git hash. [slightly OT] Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-05-31 15:59 +0100
    Re: Tagging programs with git hash. [slightly OT] Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-05-31 22:56 +0100
      Re: Tagging programs with git hash. [slightly OT] John Forkosh <forkosh@panix.com> - 2019-06-01 02:55 +0000
        Re: Tagging programs with git hash. [slightly OT] fir <profesor.fir@gmail.com> - 2019-06-01 04:26 -0700
          Re: Tagging programs with git hash. [slightly OT] fir <profesor.fir@gmail.com> - 2019-06-01 04:35 -0700
      Re: Tagging programs with git hash. [slightly OT] Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-06-01 04:03 -0700
  Re: Tagging programs with git hash. [slightly OT] "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-05-31 13:30 -0700
  Re: Tagging programs with git hash. [slightly OT] Eli the Bearded <*@eli.users.panix.com> - 2019-05-31 21:46 +0000
  Re: Tagging programs with git hash. [slightly OT] Shuggie <shuggie@latepaul.com> - 2019-06-01 11:21 +0100
  Re: Tagging programs with git hash. [slightly OT] Ike Naar <ike@iceland.freeshell.org> - 2019-06-01 21:23 +0000
    Re: Tagging programs with git hash. [slightly OT] Keith Thompson <kst-u@mib.org> - 2019-06-01 14:34 -0700
    Re: Tagging programs with git hash. [slightly OT] Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-06-02 12:36 -0700
      Re: Tagging programs with git hash. [slightly OT] Keith Thompson <kst-u@mib.org> - 2019-06-02 14:35 -0700

csiph-web