threads / discuss / 7725

Cloning of git-svn repos?

Subject: Cloning of git-svn repos?

## tl;dr

3 messages between Apr 18, 2007 and Apr 19, 2007.

replies: 2people: 3as markdown or json

Robin H. Johnson· Apr 18, 2007, 09:29 UTC · lore

(This is completely unrelated to my previous posts about using git for Gentoo, it's not the only placing I'm looking at implementing Git).

Is there a sane and git-recommended way to clone repos created with git-svn?

If I do: 'git-svn clone ....', and then git-clone of that directory, the second clone cannot use git-svn to follow the original SVN or feed stuff back to the original SVN.

If I create them separately (or by plain copying the first one to create the second), then pulling between them works fine.

The copying just feels messy compared to the initial git-clone functionality.

-- 
Robin Hugh Johnson
Gentoo Linux Developer & Council Member
E-Mail     : robbat2@gentoo.org
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85
Steven Grimm· Apr 18, 2007, 17:21 UTC · re: Robin H. Johnson · lore

Re: Cloning of git-svn repos?

Robin H. Johnson wrote:
Show 7 quoted lines
> Is there a sane and git-recommended way to clone repos created with
> git-svn?
>
> If I do: 'git-svn clone ....', and then git-clone of that directory, the
> second clone cannot use git-svn to follow the original SVN or feed stuff
> back to the original SVN.
>   

There is some git-svn-specific data in the .git directory that isn't copied by git clone. You could perhaps get away with just copying that (some stuff in .git/config, and the .git/svn subdirectory) into a cloned child.

What I usually do instead is make a parent repository with git-svn, then clone that as needed. I have a cron job that does "git-svn fetch" in the parent periodically, so the child repositories can just update from the parent to stay current. When I want to commit to svn, I push to the parent repo (be careful here since git-svn can't create non-bare repositories, so don't ever push to the currently checked-out branch in the parent), git-reset the parent to whatever svn branch I want to check into, merge the just-pushed change into the parent's current branch, then do my git-svn dcommit.

That workflow could undoubtedly be made simpler. In particular, one could use hooks in the parent repository to automatically do the reset-merge-dcommit dance. If you had that, then pushing to the parent would immediately commit those changes to svn and there'd be little reason to want to do svn operations from the cloned children.

-Steve
Sam Vilain· Apr 19, 2007, 13:03 UTC · re: Robin H. Johnson · lore

Re: Cloning of git-svn repos?

Robin H. Johnson wrote:
Show 10 quoted lines
> (This is completely unrelated to my previous posts about using git for
> Gentoo, it's not the only placing I'm looking at implementing Git).
>
> Is there a sane and git-recommended way to clone repos created with
> git-svn?
>
> If I do: 'git-svn clone ....', and then git-clone of that directory, the
> second clone cannot use git-svn to follow the original SVN or feed stuff
> back to the original SVN.
>   

You need to make sure to clone the remotes/ refs as well. See http://utsl.gen.nz/talks/git-svn/intro.html#howto-track-svn

Sam.
Show 7 quoted lines
> If I create them separately (or by plain copying the first one to create
> the second), then pulling between them works fine.
>
> The copying just feels messy compared to the initial git-clone
> functionality.
>
>   

← back to recent threads