* `git describe` in an export-subst format string?
@ 2013-04-28 18:02 John Gallagher
2013-04-28 21:32 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: John Gallagher @ 2013-04-28 18:02 UTC (permalink / raw)
To: git
I originally posted this as a question about getting `git log` to
output the same thing that `git describe` does to the git-users
mailing list, and was directed here. 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`, given the file has the export-subst
property, possibly with arguments to git describe (--tags, --all,
etc.). In a normal build I can do this with the build system just
calling git directly, but if I'm archiving a tarball off there doesn't
seem to be a way to do this (other than manually replacing the format
string myself as some secondary step).
Does this seem like a reasonable thing to do, or am I overlooking a
better alternative? If this is something that seems reasonable, I
wouldn't mind taking a stab at implementing it. If that sounds okay,
could make sure I'm pointed in the right direction? E.g., should `git
log --format=...` have options that spit out `git describe` strings
since that's what export-subst currently uses, or should there be a
separate $Format:...$ option that runs git describe?
Thanks,
John
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: `git describe` in an export-subst format string?
2013-04-28 18:02 `git describe` in an export-subst format string? John Gallagher
@ 2013-04-28 21:32 ` Junio C Hamano
2013-04-28 22:52 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2013-04-28 21:32 UTC (permalink / raw)
To: John Gallagher; +Cc: git
John Gallagher <johnkgallagher@gmail.com> writes:
> 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 )'
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: `git describe` in an export-subst format string?
2013-04-28 21:32 ` Junio C Hamano
@ 2013-04-28 22:52 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2013-04-28 22:52 UTC (permalink / raw)
To: John Gallagher; +Cc: git
Junio C Hamano <gitster@pobox.com> writes:
> John Gallagher <johnkgallagher@gmail.com> writes:
>
>> 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 )'
Just in case anybody takes it too seriously, this particular
implementaiton will never be acceptable at least for use in
"$Format:" of export-subst.
I am "tempted to" suggest, but am not crazy enough to actually doing
so ;-).
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-28 22:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-28 18:02 `git describe` in an export-subst format string? John Gallagher
2013-04-28 21:32 ` Junio C Hamano
2013-04-28 22:52 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox