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

Re: `git describe` in an export-subst format string?

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 28, 2013, 21:32 UTC
Message-ID
<7vobcypciw.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAFoDJR8RQExLwXcrViAJpWgvq+wBopY-Wq1keHxVqB3QwtAz4A@mail.gmail.com>
John Gallagher <johnkgallagher@gmail.com> writes:
Show 7 quoted lines
> The actual thing I want to do is
> something like this:
>
>   static const char *project_version = "$Format:...$";
>
> where "..." is something that `git archive` will replace with the
> output of `git describe`,...

You need to find an appropriate pair of placeholders that can represent "git describe $it" and "git describe --contains $it".

I am tempted to suggest a more generalized way that is not limited to describe at all, perhaps like this:

    $ git show --format='%x( git describe %H )'
    $ git show --format='%x( git describe --contains %H )'
Previous: John GallagherNext: Junio C Hamano
Message 2 of 3 in “`git describe` in an export-subst format string?”
  1. John GallagherApr 28, 2013
  2. Junio C HamanoApr 28, 2013
  3. Junio C HamanoApr 28, 2013

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.