git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Graham Cox <graham@grahamcox.co.uk>
Cc: git@vger.kernel.org
Subject: Re: git-archive for files changed in revision range
Date: Wed, 13 Feb 2008 08:43:13 -0500	[thread overview]
Message-ID: <20080213134313.GA3617@coredump.intra.peff.net> (raw)
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

  parent reply	other threads:[~2008-02-13 13:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13 13:03 git-archive for files changed in revision range Graham Cox
2008-02-13 13:37 ` Johannes Schindelin
2008-02-13 13:43 ` Jeff King [this message]
2008-02-13 13:43 ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080213134313.GA3617@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=graham@grahamcox.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).