openlayers svn into git

Tim Abell · February 4, 2010

Initial clone:
<pre>git svn clone -T trunk/openlayers/ -t tags/openlayers/ -b branches/openlayers/ http://svn.openlayers.org/ openlayers.git</pre>
“http://svn.openlayers.org/tags/openlayers/docs-2.8/” is in the wrong place and gets pulled in by the git clone.

I should have used --no-follow-parent to avoid the docs-2.8 tag pulling in docs history but not going to re-clone now. If you are repeating this, try this instead:
<pre>git svn clone --no-follow-parent -T trunk/openlayers/ -t tags/openlayers/ -b branches/openlayers/ http://svn.openlayers.org/ openlayers.git
</pre>
Find the errant docs branches & eliminate:
<pre>cd openlayers.git
for x in `git for-each-ref --format="%(refname)" 'refs/remotes/tags/docs*'`; do git update-ref -d $x; done
</pre>
# http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
# expunge old objects (I think this works)
<pre>git reflog expire --all
git gc --aggressive --prune
</pre>
Then run: http://www.shatow.net/fix-svn-refs.sh to create real git tags.

If you just want the result you can download a copy complete with svn metadata from http://www.timwise.co.uk/openlayers-dev/openlayers.git.tgz

You will then be able to run
<pre>git svn fetch
</pre>
to get updates from the openlayers svn server.

There is a published copy at http://github.com/timabell/openlayers, though it doesn’t have the svn metadata.

<hr />
I also tackled the docs folder:

The docs directory has no matching branch or tag directories, so the following is sufficient:
<pre>git svn clone -T trunk/doc http://svn.openlayers.org/ openlayers-doc.git
git gc --aggressive --prune
</pre>
You can download this from http://www.timwise.co.uk/openlayers-dev/openlayers-doc.git.tgz

<hr />
Anything else I come up with will end up at http://www.timwise.co.uk/openlayers-dev/

Share: Tweet | LinkedIn
Suggest improvments: page source on github