Re: [PATCH 1/2] pretty: add %(describe)
- From
René Scharfe. <l.s.r@web.de>
- Date
- Feb 16, 2021, 17:13 UTC
- Message-ID
- <66720982-04d6-3096-9ea2-ea5bc3fcd121@web.de>
- In-Reply-To
- <87pn109nhr.fsf@evledraar.gmail.com>
Am 16.02.21 um 14:00 schrieb Ævar Arnfjörð Bjarmason:
Show 15 quoted lines
> > On Sun, Feb 14 2021, René Scharfe wrote: > >> Add a format placeholder for describe output. Implement it by actually >> calling git describe, which is simple and guarantees correctness. It's >> intended to be used with $Format:...$ in files with the attribute >> export-subst and git archive. > > Does it really guarantee correctness though? In "builtin/describe.c" we > first walk over the refs and use that to format all N items we're asked > about. > > Under "git log" this is presumably in a race where refs added/deleted > during the run of "git log" will change the describe output to be > inconsistent with earlier lines.
Right, didn't think of that aspect. So we'd better warn about the raciness in the documentation.
We could improve that by keeping a single describe process around and feeding it object names through a pipe as we go. The results would still become outdated after a ref is added or removed, but they'd be consistent. This would be faster as well.
René