weishirongzhen1 / git-repo

Automatically exported from code.google.com/p/git-repo
Apache License 2.0
0 stars 0 forks source link

Share project-objects between multiple workspaces #179

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Affected Version: 1.12.16
Environment: Ubuntu 14.04 LTS

I work on many android baselines at once, each has a completely separate 
workspace. These workspaces use similar sets of git projects, but each may 
choose different branches in the manifest. This leads to significant disk space 
and network overhead to store and fetch the duplicate git history across many 
workspaces.

To attempt to address this, I started creating a common PROJECTS folder outside 
of all of my repo workspaces, and then creating symlinks in each 
$workspace/.repo/projects to ../../../PROJECTS/repo/projects. This accomplished 
the goals above, until a few things changed.

Here is an example to illustrate the problem:
workspace A:
<project path="foo" name="bar" />
workspace B:
<project path="foo" name="baz" />

With the project symlinks configured as above, doing a repo sync on workspace A 
gets the its "foo" project into the correct state, but will incorrectly change 
the remote in the workspace B "foo" project to point at "bar" instead of "baz".

Would you be able to add functionality to repo which handles the above case? 
Ideally I would like the repos in different workspaces to share branches, so 
that I can easily port and examine changes.

The problem is further complicated by Issue 141, which introduced the 
project-objects folder. This required me to create additional project-objects 
symlinks for each project as well.

If I understand https://gerrit-review.googlesource.com/#/c/50715 correctly, the 
closest solution would be to create symlinks for only the project-objects 
directory, and allow each workspace to have its own projects folder. This makes 
sense because project-objects is the bulk of the git storage, while projects is 
only branch names. However, this approach might cause problems with garbage 
collection, since repo won't be aware of how many places link to the same 
project-objects directory.

Original issue reported on code.google.com by fetti...@motorola.com on 11 Aug 2014 at 8:06