Subject: tracking repository

From: kenneth johansson <[email-masked]>
Date: Sat, 15 Mar 2008 19:35:12 +0000 (UTC)

I was trying to create a repository used only to track different linux git 
repositories. The goal with this was to maximize object sharing and having 
one local copy of the data. 

But I think I managed to paint myself into a corner. Here was my initial 
setup. 

create a directory 
"mkdir linux"

create a git data base
"cd linux; git --bare init"

Add a few linux repositories with
"git --bare remote add [name] [url]"

then download the objects/branches with
"git remote update"

This works great and it will track all changes in the remote repositories 
without me having to worry about it aborting due to merge issues with my 
local branch or remote  doing rebase on some branch.

The problem is that it is useless :( I can't find any way to use a 
repository with only remotes in it. Is there a way to make a clone of a 
remote branch in a repository ??

Now it is not entirely useless since I can reuse the objects downloaded by 
setting GIT_OBJECT_DIRECTORY. This works quite well until "git gc --prune" 
is used. I leave it up to the reader to figure out what happens then :(

So I guess there should be some warning about using GIT_OBJECT_DIRECTORY 
that points to the same object store for different repositories. It's 
obvious but still a warning in the man page could be helpful.

GIT_ALTERNATE_OBJECT_DIRECTORIES works much better. The only potential 
problem I see is if I set this is set in my environment when I login and 
then do operation on my tracking repository's it will now point into it's 
own object directory. I have not tried that yet.

The downside of only using the objects is that I need to setup the remotes 
again in my clone. 

Now has anybody tried to do something similar? is there a better way?