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

Bug: git archive not doing export-subst when using --prefix= option

From
USUlrik Sverdrup <ulrik.sverdrup@gmail.com>
Date
Apr 8, 2008, 21:35 UTC
Message-ID
<a1b6cb1b0804081435w24074d1aq177e8c1a5e1af0f8@mail.gmail.com>

In one of my small projects, I just tried to add an export-subst format to my version file to have the git version in the released tarball. However it seems git-archive --prefix="tarballname-version/" does not work well together with export-subst.

I have very old git! (v1.5.4.4). So please help me and try to reproduce this with newer versions:

The repo is publicly available at
git clone git://repo.or.cz/dragbox.git

The file in the repo having an export substitution format is Dragbox/version.py.in

Now try to export the git tree with git-archive, with and without --prefix= We will do some hackery and grep the binary output.

	$ git archive HEAD | grep --text "git_version"
	git_version = "9c3f6c0af7e67a354cac9a24e24e2057d17778ef"
	$ git archive --prefix="dragbox-git/" HEAD | grep --text "git_version"
	git_version = "$Format:%H$"

I noticed in another even smaller repository that it would not behave the same but equally spurious; it would only perform the substitution for some prefixes and not for others (for example with or without ending slash)

Regards Ulrik Sverdrup

Next: René Scharfe
Message 1 of 4 in “Bug: git archive not doing export-subst when using --prefix= option”
  1. Ulrik SverdrupApr 8, 2008
  2. git-archive: ignore prefix when checking file attributeRené Scharfe, Apr 9, 2008
  3. Ulrik SverdrupApr 9, 2008
  4. Junio C HamanoApr 10, 2008

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.