# [RFC] Mirroring svn

5 messages from 2007-12-06 to 2007-12-06. Participants: Harvey Harrison, Jeff King, Johannes Schindelin.
Thread: https://gitlist.dev/t/11156

## Harvey Harrison, 2007-12-06 06:22

Subject: [RFC] Mirroring svn
Message-ID: <1196922153.10408.101.camel@brick>
URL: https://gitlist.dev/e/1196922153.10408.101.camel%40brick

```
After the discussions lately regarding the gcc svn mirror.  I'm coming
up with a recipe to set up your own git-svn mirror.  Suggestions on the
following.

// Create directory and initialize git
mkdir gcc
cd gcc
git init
// add the remote site that currently mirrors gcc
// I have chosen the name gcc.gnu.org *1* as my local name to refer to
// this choose something else if you like
git remote add gcc.gnu.org git://git.infradead.org/gcc.git
// fetching someone else's remote branches is not a standard thing to do
// so we'll need to edit our .git/config file
// you should have a section that looks like:
[remote "gcc.gnu.org"]
	url = git://git.infradead.org/gcc.git
	fetch = +refs/heads/*:refs/remotes/gcc.gnu.org/*
// infradead's mirror puts the gcc svn branches in its own namespace
// refs/remotes/gcc.gnu.org/*
// change our fetch line accordingly
[remote "gcc.gnu.org"]
	url = git://git.infradead.org/gcc.git
	fetch = +refs/remotes/gcc.gnu.org/*:refs/remotes/gcc.gnu.org/*
// fetch the remote data from the mirror site
git remote update
// set up git-svn
// gcc has the standard trunk/branches/tags naming so use -s
// add a prefix so git-svn uses the metadata we just got from the
// mirror so we don't have to get everything from the svn server
// the --prefix must match whatever you chose in *1*, the trailing
// slash is important.
git svn init -s --prefix=gcc.gnu.org/ svn://gcc.gnu.org/svn/gcc
// your config should look like this now:
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "gccmirror"]
	url = git://git.infradead.org/gcc.git
	fetch = +refs/heads/*:refs/remotes/gccmirror/*
[svn-remote "svn"]
	url = svn://gcc.gnu.org/svn/gcc
	fetch = trunk:refs/remotes/gcc.gnu.org/trunk
	branches = branches/*:refs/remotes/gcc.gnu.org/*
	tags = tags/*:refs/remotes/gcc.gnu.org/tags/*
// Try and get more revisions from the svn server
// this may take a little while the first time as git-svn builds
// metadata to allow bi-directional operation
git svn fetch


Happy Hacking

Harvey Harrison

```

## Jeff King, 2007-12-06 06:43

Subject: Re: [RFC] Mirroring svn
Message-ID: <20071206064317.GC18698@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20071206064317.GC18698%40coredump.intra.peff.net
In-Reply-To: <1196922153.10408.101.camel@brick>

```
On Wed, Dec 05, 2007 at 10:22:33PM -0800, Harvey Harrison wrote:

> // fetching someone else's remote branches is not a standard thing to do
> // so we'll need to edit our .git/config file
> // you should have a section that looks like:
> [remote "gcc.gnu.org"]
> 	url = git://git.infradead.org/gcc.git
> 	fetch = +refs/heads/*:refs/remotes/gcc.gnu.org/*
> // infradead's mirror puts the gcc svn branches in its own namespace
> // refs/remotes/gcc.gnu.org/*
> // change our fetch line accordingly
> [remote "gcc.gnu.org"]
> 	url = git://git.infradead.org/gcc.git
> 	fetch = +refs/remotes/gcc.gnu.org/*:refs/remotes/gcc.gnu.org/*

FWIW, if you are writing a shell recipe for other people to cut and
paste, you can say this as:

  git config remote.gcc.gnu.org.fetch \
    '+refs/remotes/gcc.gnu.org/*:refs/remotes/gcc.gnu.org/*'

-Peff

```

## Harvey Harrison, 2007-12-06 06:45

Subject: Re: [RFC] Mirroring svn
Message-ID: <1196923525.10408.103.camel@brick>
URL: https://gitlist.dev/e/1196923525.10408.103.camel%40brick
In-Reply-To: <20071206064317.GC18698@coredump.intra.peff.net>

```
On Thu, 2007-12-06 at 01:43 -0500, Jeff King wrote:
> On Wed, Dec 05, 2007 at 10:22:33PM -0800, Harvey Harrison wrote:
> 
> > // fetching someone else's remote branches is not a standard thing to do
> > // so we'll need to edit our .git/config file
> > // you should have a section that looks like:
> > [remote "gcc.gnu.org"]
> > 	url = git://git.infradead.org/gcc.git
> > 	fetch = +refs/heads/*:refs/remotes/gcc.gnu.org/*
> > // infradead's mirror puts the gcc svn branches in its own namespace
> > // refs/remotes/gcc.gnu.org/*
> > // change our fetch line accordingly
> > [remote "gcc.gnu.org"]
> > 	url = git://git.infradead.org/gcc.git
> > 	fetch = +refs/remotes/gcc.gnu.org/*:refs/remotes/gcc.gnu.org/*
> 
> FWIW, if you are writing a shell recipe for other people to cut and
> paste, you can say this as:
> 
>   git config remote.gcc.gnu.org.fetch \
>     '+refs/remotes/gcc.gnu.org/*:refs/remotes/gcc.gnu.org/*'

I thought about that, but I like to encourage people to actually look at
the config file, it's pretty easy to understand.

Harvey

```

## Johannes Schindelin, 2007-12-06 12:15

Subject: Re: [RFC] Mirroring svn
Message-ID: <Pine.LNX.4.64.0712061214340.27959@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0712061214340.27959%40racer.site
In-Reply-To: <1196923525.10408.103.camel@brick>

```
Hi,

On Wed, 5 Dec 2007, Harvey Harrison wrote:

> On Thu, 2007-12-06 at 01:43 -0500, Jeff King wrote:
> > On Wed, Dec 05, 2007 at 10:22:33PM -0800, Harvey Harrison wrote:
> > 
> > > // fetching someone else's remote branches is not a standard thing to do
> > > // so we'll need to edit our .git/config file
> > > // you should have a section that looks like:
> > > [remote "gcc.gnu.org"]
> > > 	url = git://git.infradead.org/gcc.git
> > > 	fetch = +refs/heads/*:refs/remotes/gcc.gnu.org/*
> > > // infradead's mirror puts the gcc svn branches in its own namespace
> > > // refs/remotes/gcc.gnu.org/*
> > > // change our fetch line accordingly
> > > [remote "gcc.gnu.org"]
> > > 	url = git://git.infradead.org/gcc.git
> > > 	fetch = +refs/remotes/gcc.gnu.org/*:refs/remotes/gcc.gnu.org/*
> > 
> > FWIW, if you are writing a shell recipe for other people to cut and
> > paste, you can say this as:
> > 
> >   git config remote.gcc.gnu.org.fetch \
> >     '+refs/remotes/gcc.gnu.org/*:refs/remotes/gcc.gnu.org/*'
> 
> I thought about that, but I like to encourage people to actually look at 
> the config file, it's pretty easy to understand.

I agree that people should be encouraged to edit their .git/config.  But a 
recipe is something easy-to-follow IMHO, so I would write this as a shell 
script (with #-comments, not //-comments).

Ciao,
Dscho

```

## Harvey Harrison, 2007-12-06 12:18

Subject: Re: [RFC] Mirroring svn
Message-ID: <1196943531.13311.0.camel@brick>
URL: https://gitlist.dev/e/1196943531.13311.0.camel%40brick
In-Reply-To: <Pine.LNX.4.64.0712061214340.27959@racer.site>

```
On Thu, 2007-12-06 at 12:15 +0000, Johannes Schindelin wrote:
> Hi,
> 
> On Wed, 5 Dec 2007, Harvey Harrison wrote:
> 
> > On Thu, 2007-12-06 at 01:43 -0500, Jeff King wrote:
> > > On Wed, Dec 05, 2007 at 10:22:33PM -0800, Harvey Harrison wrote:
> > > 
> > > > // fetching someone else's remote branches is not a standard thing to do
> > > > // so we'll need to edit our .git/config file
> > > > // you should have a section that looks like:
> > > > [remote "gcc.gnu.org"]
> > > > 	url = git://git.infradead.org/gcc.git
> > > > 	fetch = +refs/heads/*:refs/remotes/gcc.gnu.org/*
> > > > // infradead's mirror puts the gcc svn branches in its own namespace
> > > > // refs/remotes/gcc.gnu.org/*
> > > > // change our fetch line accordingly
> > > > [remote "gcc.gnu.org"]
> > > > 	url = git://git.infradead.org/gcc.git
> > > > 	fetch = +refs/remotes/gcc.gnu.org/*:refs/remotes/gcc.gnu.org/*
> > > 
> > > FWIW, if you are writing a shell recipe for other people to cut and
> > > paste, you can say this as:
> > > 
> > >   git config remote.gcc.gnu.org.fetch \
> > >     '+refs/remotes/gcc.gnu.org/*:refs/remotes/gcc.gnu.org/*'
> > 
> > I thought about that, but I like to encourage people to actually look at 
> > the config file, it's pretty easy to understand.
> 
> I agree that people should be encouraged to edit their .git/config.  But a 
> recipe is something easy-to-follow IMHO, so I would write this as a shell 
> script (with #-comments, not //-comments).

I'll probably turn it into such eventually, this was more of a
hand-holding exercise for people who would like to try git in gcc-land.

Harvey

```
