* git-archive for files changed in revision range
@ 2008-02-13 13:03 Graham Cox
2008-02-13 13:37 ` Johannes Schindelin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Graham Cox @ 2008-02-13 13:03 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]
Hiya,
We have a small project that is being managed in a Git repository (MSysGit to
be exact) - mostly for backups and so on. The project is a mod for the
computer game Civilization 4. (Actually a mod of a mod, but still...) As
such, to release the mod to other people to actually use the only thing that
needs to be released is all of the files that have actually been changed. (The
actual git repository contains ~700MB of files, the vast majority of which
haven't changed since the initial import and so don't need to be downloaded by
people).
I've managed to make it produce an archive that contains only the files that
have changed by using a combination of git-archive and git-whatchanged, along
with grep and sed, but it's kinda unwieldly. Is there a better way of doing
this?
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
To produce a zip containing all of the modified and added files for the
revision range <start>..HEAD.
--
Graham Cox
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-archive for files changed in revision range
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
2008-02-13 13:43 ` Johannes Sixt
2 siblings, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2008-02-13 13:37 UTC (permalink / raw)
To: Graham Cox; +Cc: git
Hi,
On Wed, 13 Feb 2008, Graham Cox wrote:
> We have a small project that is being managed in a Git repository
> (MSysGit to be exact) - mostly for backups and so on. The project is a
> mod for the computer game Civilization 4. (Actually a mod of a mod, but
> still...) As such, to release the mod to other people to actually use
> the only thing that needs to be released is all of the files that have
> actually been changed. (The actual git repository contains ~700MB of
> files, the vast majority of which haven't changed since the initial
> import and so don't need to be downloaded by people).
>
> I've managed to make it produce an archive that contains only the files
> that have changed by using a combination of git-archive and
> git-whatchanged, along with grep and sed, but it's kinda unwieldly. Is
> there a better way of doing this?
>
> 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
>
> To produce a zip containing all of the modified and added files for the
> revision range <start>..HEAD.
Mebbe
git archive --format=zip HEAD \
$(git diff-tree -r --name-only --diff-filter=AM \
<start>..HEAD)
Hmm?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-archive for files changed in revision range
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
2008-02-13 13:43 ` Johannes Sixt
2 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2008-02-13 13:43 UTC (permalink / raw)
To: Graham Cox; +Cc: git
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-archive for files changed in revision range
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
@ 2008-02-13 13:43 ` Johannes Sixt
2 siblings, 0 replies; 4+ messages in thread
From: Johannes Sixt @ 2008-02-13 13:43 UTC (permalink / raw)
To: Graham Cox; +Cc: git
Graham Cox schrieb:
> 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
>
> To produce a zip containing all of the modified and added files for the
> revision range <start>..HEAD.
git diff-tree -r --name-only -z <start> HEAD | \
xargs -0 git archive --format=zip HEAD > release.zip
-- Hannes
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-02-13 13:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2008-02-13 13:43 ` Johannes Sixt
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).