Subject: Re: multiple working directories for long-running builds (was: "git merge" merges too much!)

From: Jeff Epler <[email-masked]>
Date: Tue, 1 Dec 2009 16:25:26 -0600

On Wed, Dec 02, 2009 at 12:18:30AM +0300, Dmitry Potapov wrote:
> AFAIK, "git archive" is cheaper than git clone. I do not say it is fast
> for huge project, but if you want to run a process such as clean build
> and test that takes a long time anyway, it does not add much to the
> total time.

If you want to keep a separate copy of your source tree in order to get
consistent builds, "git archive" is not much cheaper in disk space or in
time, at least on this unix system:

$ find orig -exec md5sum {} + > /dev/null 2>&1 # ensure hot cache
$ time git clone orig temp-clone
Initialized empty Git repository in
/usr/local/jepler/src/temp-clone/.git/
0.6 real 0.3 user 0.6 system
$ time (GIT_DIR=orig/.git git archive --format tar --prefix temp-archive/ HEAD | tar xf -)
0.5 real 0.2 user 0.5 system
$ du -s orig temp-clone temp-archive
41880   orig
14640   temp-clone  # du excludes files already accounted for by 'orig'
14304   temp-archive

.. and the next run to bring temp-clone up to date can be even faster,
since it's just 'git pull' and will only touch changed files.

Jeff