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

Re: git-archive for files changed in revision range

From
Jeff King <peff@peff.net>
Date
Feb 13, 2008, 13:43 UTC
Message-ID
<20080213134313.GA3617@coredump.intra.peff.net>
In-Reply-To
<20080213130304.GA19957@grahamcox.co.uk>
On Wed, Feb 13, 2008 at 01:03:04PM +0000, Graham Cox wrote:
> The command line I used was something like (This is mostly from memory):
> git-archive --format=zip . `git-whatchanged <start>..HEAD --pretty=oneline 
>   | grep '^:' | sed 's/^.*\t//'` > release.zip

That will list files multiple times if they were modified in more than one commit. And really, there's no need to walk the history. You really are just comparing against two points (your baseline and your current state). Walking the history will also erroneously include files which changed, but then reverted back to their original state (though I expect that is the uncommon case).

How about:
  # mark our start point for this and future releases
  git tag baseline `git rev-list HEAD | tail -n 1`
  # find files which differ between then and now; but we only need
  # to care about added and modified files, since deleted ones
  # don't need to be shipped
  git diff --diff-filter=AM --raw baseline HEAD | awk '{print $6}' >files
  # and archive
  git archive --format=zip HEAD `cat files`

You can even use diff's "-z" option if you have filenames that are hard to quote, but I will leave that as an exercise to the reader.

-Peff
Previous: Johannes SchindelinNext: Johannes Sixt
Message 3 of 4 in “git-archive for files changed in revision range”
  1. Graham CoxFeb 13, 2008
  2. Johannes SchindelinFeb 13, 2008
  3. Jeff KingFeb 13, 2008
  4. Johannes SixtFeb 13, 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.