DamZ taught me a great new piece of git trivia today. You can use a local repository as a kind of cache for a git clone.
Let's create a reference repository for Drupal (and it will be bare, because we don't need any files checked out)
git clone --mirror git://git.drupal.org/project/drupal.git ~/gitcaches/drupal.reference
That makes a complete clone of Drupal's full history in ~/gitcaches/drupal.reference
Now when I need to clone the Drupal project's entire history (as I might do often in testing) I can
git clone --reference ~/gitcaches/drupal.reference git://git.drupal.org/project/drupal.git
And the clone time is on the order of 2 seconds instead of several minutes. And yes, it picks up new changes that may have happened in the real remote repository.
To go beyond this (again from DamZ) we can have a reference repository that has many projects referenced within it.
mkdir -p ~/gitcaches/reference
git init --bare
for repo in drupal views cck examples panels # whatever you want here
git remote add $repo git://git.drupal.org/project/$repo.git
git fetch --all
Now I have just one big bare repo that I can use as a cache. I might update it from time to time with
git fetch --all. But I don't have to. And I can use it like this:
git clone --reference ~/gitcaches/reference git://git.drupal.org/project/drupal.git
git clone --reference ~/gitcaches/reference git://git.drupal.org/project/examples.git
We'll try to use this technique for the testbots, which do several clean checkouts per patch tested, as it should speed them up by at least a minute per test.
Edit: Here is the version that I used with the testbots, as it appears as a gist: