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

[PATCH] Makefile: don't hardcode HEAD in dist target

From
Dennis Kaarsemaker <dennis@kaarsemaker.net>
Date
May 31, 2014, 20:25 UTC
Message-ID
<20140531202507.GA9101@spirit>

Instead of calling git-archive HEAD^{tree}, use $(GIT_VERSION)^{tree}. This makes sure the archive name and contents are consistent, if HEAD has moved, but GIT-VERSION-FILE hasn't been regenerated yet.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
---
I have a somewhat odd setup in which I share a .git between multiple
checkouts for automated builds. To minimize locking time for parallel
builds with different options, there's only a lock around checkout and
running git describe $commit > version, the builds themselves run in
parallel.

This works just fine except during 'make dist', which is hardcoded to package up HEAD, but that's not always the commit that is actually checked out, another process may have checked out something else.

I realize this setup is somewhat strange, but the only change necessary to make this work is this one-line patch, so I hope that's acceptable.

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index a53f3a8..63d9bac 100644
--- a/Makefile
+++ b/Makefile
@@ -2433,7 +2433,7 @@ git.spec: git.spec.in GIT-VERSION-FILE
 GIT_TARNAME = git-$(GIT_VERSION)
 dist: git.spec git-archive$(X) configure
 	./git-archive --format=tar \
-		--prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
+		--prefix=$(GIT_TARNAME)/ $(GIT_VERSION)^{tree} > $(GIT_TARNAME).tar
 	@mkdir -p $(GIT_TARNAME)
 	@cp git.spec configure $(GIT_TARNAME)
 	@echo $(GIT_VERSION) > $(GIT_TARNAME)/version
-- 
2.0.0-538-ga6b2d95
Next: Junio C Hamano
Message 1 of 4 in “Makefile: don't hardcode HEAD in dist target”
  1. Makefile: don't hardcode HEAD in dist targetDennis Kaarsemaker, May 31, 2014
  2. Junio C HamanoJun 2, 2014
  3. Dennis KaarsemakerJun 2, 2014
  4. Junio C HamanoJun 2, 2014

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.