Subject: Re: Saving space/network on common repos

From: Jonathan Nieder <[email-masked]>
Date: Wed, 17 Dec 2014 14:32:15 -0800

(+cc: Duy who wrote the recent 'checkout --to' patch series)
Hi Craig,

Craig Silverstein wrote:

>          By design, our Jenkins machine has several different
> directories that each hold a copy of the same git repository.  (For
> instance, Jenkins may be running tests on our repo at several
> different commits at the same time.)  When Jenkins decides to run a
> test -- I'm simplifying a bit -- it will pick one of the copies of the
> repo, do a 'git fetch origin && git checkout <some commit>' and the
> run the tests.

You might find 'git new-workdir' from contrib/workdir to be helpful.
It lets you attach multiple working copies to a single set of objects
and refs.

There's a patch series to move that functionality into core git
through an option "git checkout --to=<directory>" that creates a
new workdir for an existing repository that is currently in the
pu ("proposed updates") branch.

[...]
> An added complication is submodules.  We have a submodule that is as
> big and slow to fetch as our main repository.
>
> Question 4) Is there a practical way to set up submodules so they can
> use the same object-sharing framework that the main repo does?

It's possible to do, but we haven't written a nice UI for it yet.
(In other words, you can do this by cloning with --no-recurse-submodules
and manually creating the submodule workdir in the appropriate place.
Later calls to "git submodule update" will do the right thing.)

Thanks for a useful example,
Jonathan