Paul

On Thu, Jun 2, 2011 at 9:24 AM, Paul Sokolovsky <paul.sokolovsky@linaro.org> wrote:

This is even more interesting, with Google people confirming that repo
--mirror works within some bounds and limitations:

http://groups.google.com/group/repo-discuss/browse_thread/thread/401656c3ad0a4a0c

Finally, here's typical usage scenario for repo --mirror (which is
pretty underdocumented):

http://www.excentral.org/archives/2011/02/24/android-repo-mirroring

So, like "repo help init" says, mirror created with repo --mirror
should later be used with repo --reference, with both mirror and
checkout using it to be located on local filesystem. I couldn't find
referenced that repo --mirror is intended for use like we do - to serve
it using git-daemon.

My next step was trying to do real git mirror (git clone --mirror), and
already did it and prepared to move it into intended location, when I
did ls -l in the mirror directory:

drwxr-xr-x 7 git-mirror nogroup 4096 2011-06-02 00:11 kernel-tilt.git
drwxr-xr-x 7 git-mirror nogroup 4096 2011-06-01 12:30 kernel-tilt.git.git

Once I moved that ".git.git" repo away, original issue with repo sync
resolved. I have no idea that double-.git repo was created. Based on
the timestamp, it was created first, and later barely updated, with
mirror and just git clone using the proper repo, while repo sync on the
build slave managing to pick up wrong one. I wonder, if that (creation
of 2 repos) could be a result of some race condition.

And I wish this issue could be called resolved, but as quoted above,
there're (more) issues are known with git --mirror, so I decided to put
up this mail with the links, for the next time such issues may come.

I have spent some time in the past with repo --mirror (we have internal mirrors within TI). After several attempts my conclusion was that it was not the best approach. the main problem is that repo --mirror expects that you give a manifest tree. If you have several branches in your manifest tree (like it's the case for the omapmanifest on git.omapzoom.org), repo sync will only sync the branch you've used initially. So if you have new or different trees on other branches they aren't sync'd. that pretty much means that you need 1 mirror for each manifest branch. (in fact I am the one that asked the repo --mirror question you've found!)

so i ended it doing a git mirror, and I wrote this simple helper script https://github.com/ndechesne/git-mirror which can be used to mirror a complete 'git server' using gitweb. for example, you just need to add this in a cron:

git-mirror -o /data/git/repositories/ -s http://git.omapzoom.org -g git://git.omapzoom.org

and the script will mirror the server locally. everytime it runs:
- it creates new trees that have appeared on the remote
- updates all existing trees
- removed trees that have disappeared from the remote.

i have been using this script on several mirror (1 at every site) quite reliably for ~2 years. prior to that I was using repo sync and frequently had failures...

hope this helps.