Subject: updating only changed files source directory?

From: Han-Wen Nienhuys <[email-masked]>
Date: Tue, 24 Oct 2006 03:33:18 +0200

Hello there,

I'm just starting out with GIT.  Initially, I want to use experiment 
with integrating it into our binary builder structure for LilyPond.

The binary builder roughly does this:

  1. get source code updates from a server to a single, local
     repository. This is currently a git repository that is that
     tracks our CVS server.

  2. copy latest commit from a branch to separate source directory.
     This copy should only update files that changed.

  3. Incrementally compile from that source directory

The binary builder does this for several branches and several
platforms of the project. Due to parallel compilation, it might even
be possible that different branches of are being checked out
concurrently from a single repository.

For a VCS, this is slightly nonstandard use, as we don't do any work
in the working dir, we just compile from it, but have many working
directories.

I have some questions and remarks

* Is there a command analogous to git-clone for updating a repository?
Right now, I'm using a combination of

   git-http-fetch -a <branch>  <url>
   wget <url>/refs/head/<branch>    ## dump to <myrepo>/refs/head/<branch>

for all branches I want to know about.  I was looking for a command
that would update the heads of all branches.

* Why is the order of args in git-http-fetch inconsistent with the
order in git-fetch? in fetch, the repository comes first, in
http-fetch, it comes last

* How do I update a source directory?

I can do the following

   git --git-dir <myrepo> read-tree <committish>

   cd <srcdir>
   git --git-dir <myrepo> checkout-index -a -f

Unfortunately, this touches all files, which messes up the timestamps
triggering needless recompilation. How can I make checkout-index only
touch files that have changed?  Or alternatively,  make checkout-index
remember timestamps on files that didn't change?

Of course, I can store the commitish of the last version of the
srcdir, and apply the diff between both to the source directory, but 
that seems somewhat convoluted. Is there a better way?

* As far as I can see, there is no reason to have only one index in a
git repository. Why isn't it possible to specify an alternate
index-file with an option similar to --git-dir ?

-- 
  Han-Wen Nienhuys - [email-masked] - http://www.xs4all.nl/~hanwen