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

Re: git gc seems to break --symbolic-full-name

From
Jeff King <peff@peff.net>
Date
Jul 26, 2017, 13:23 UTC
Message-ID
<20170726132322.4cfj73tynrko264o@sigill.intra.peff.net>
In-Reply-To
<a6738cae-ad8d-cf51-0fbb-428cf0f88703@list.ru>
On Wed, Jul 26, 2017 at 11:40:46AM +0300, Stas Sergeev wrote:
Show 22 quoted lines
> 26.07.2017 03:36, Jacob Keller пишет:
> > If your goal is to make it so users filling out bug reports have a
> > version, then using git descrsibe and making that be part of your
> > version (based off your tags, and commits) is how pretty much every
> > other project I've worked on does this.
> > 
> > I really don't think that's your goal here, given you're doing things
> > in make with timestamps and builds, so I guess I misunderstood your
> > answer?
> There are 2 different things:
> 1. put git describe output into some header file
> 2. make things to rebuild with every new commit
> 
> So I actually stuck at solving 2, because 1 is trivial.
> My original solution for 2 was to "depend" on
> refs/heads/*. This worked besides git gc, but had
> a lot of troubles with worktrees. And this time I
> switched to the "touch tmpfile" trick with the date
> taken from git log. This requires .LOW_RESOLUTION_TIME
> in makefile, so probably not the best solution again,
> but should hopefully be more future-proof than the
> previous one.
In git.git we do something like:
-- >8 --
other: version
	cat $< >$@
.PHONY: FORCE
version: FORCE
	@git rev-parse HEAD >$@+
	@if cmp $@+ $@ >/dev/null 2>&1; then rm $@+; else mv $@+ $@; fi
-- >8 --

The "version" commands run always, but they only update the file if there's a change. At least GNU make is smart enough to know that if "version" was not updated, then "other" does not need to be re-built. I don't know if all makes would so, though.

-Peff
Previous: Stas SergeevNext: Stas Sergeev
Message 11 of 12 in “git gc seems to break --symbolic-full-name”
  1. Stas SergeevJul 21, 2017
  2. Junio C HamanoJul 21, 2017
  3. Stas SergeevJul 21, 2017
  4. Jacob KellerJul 23, 2017
  5. Stas SergeevJul 23, 2017
  6. Jacob KellerJul 24, 2017
  7. Stas SergeevJul 24, 2017
  8. Stas SergeevJul 26, 2017
  9. Jacob KellerJul 26, 2017
  10. Stas SergeevJul 26, 2017
  11. Jeff KingJul 26, 2017
  12. Stas SergeevJul 26, 2017

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.