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

Passing commit IDs to git-archive

From
SBStephen Bash <bash@genarts.com>
Date
Mar 9, 2012, 22:14 UTC
Message-ID
<8fb14091-99dc-4383-9cab-5bf508e0a554@mail>
In-Reply-To
<8c6d921d-9e8e-4caf-bc04-b1d2cfdd294f@mail>
Hi all-
For an upcoming release, I'm attempting to update our build scripts to suck down some content from a remote Git repository and include it en masse in our installer.  My first inclination was to use submodules, but similar to this question on Stack Overflow
  http://stackoverflow.com/questions/6553743/
the content used to be in our development repository and has recently been migrated out, so jumping between branches/back and forth in history is causing problems (unlike the question, I'm not willing to rewrite history to make the submodule approach work).  So after googling around I came to git-archive using the --remote argument, which actually seems nice for my situation because the content is basically support material for the end user that the devs don't manage/edit.
Unfortunately I just attempted
  warp:bar bash$ git archive --remote=file:///Users/bash/Development/foo \
                             --output=test.tgz 3b9e49b \
                             path/to/subdir
  remote: fatal: no such ref: 3b9e49b
  remote: git upload-archive: archiver died with error
  fatal: sent error to the client: git upload-archive: archiver died with error
  warp:bar bash$ git archive --remote=file:///Users/bash/Development/foo \
                             --output=test.tgz 3b9e49b:path/to/subdir
  remote: fatal: no such ref: 3b9e49b
  remote: git upload-archive: archiver died with error
  fatal: sent error to the client: git upload-archive: archiver died with error
  warp:bar bash$ cd /Users/bash/Development/foo
  warp:foo bash$ git rev-parse --short master
  3b9e49b
  warp:foo bash$ 
  warp:foo bash$ git --version
  git version 1.7.9.2
  warp:foo bash$ 
on Mac OS 10.6.8 (obviously this is local testing, the goal is to use ssh remotely).  After parsing the error "no such ref" I attempted the same operation using master as the tree-ish and archive worked as expected (either specifying the path separately or using the colon syntax to reference the tree directly).  Is there a reason git-archive requires a named ref rather than just a commit (or tree) ID?  If not, would it be difficult to patch git-upload-archive to use the IDs?  I could use tags for the ref, but in my case would result in almost every commit being a tag which seems wasteful.
Thoughts?  Thanks in advance!
Stephen
Next: Junio C Hamano
Message 1 of 5 in “Passing commit IDs to git-archive”
  1. Stephen BashMar 9, 2012
  2. Junio C HamanoMar 9, 2012
  3. René ScharfeMar 10, 2012
  4. Jeff KingMar 12, 2012
  5. Stephen BashMar 12, 2012

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.