hi, i'm using git-svn for projects where i don't just want to commit to trunk but to other branches, too. for example: git-svn clone -s svn+ssh://vmiklos@svn.gnome.org/svn/ooo-build ooo-build then i have a local 'master' branch and all the other branches are local branches. so, when i want to work in the ooo-build-2-3 branch, i do a: git checkout -b ooo-build-2-3 ooo-build-2-3 but when i do a git svn rebase, i get: warning: refname 'ooo-build-2-3' is ambiguous. what am i doing wrong? in fact i suspect that in case i would use some other branch name, like simply '2-3' then i could get rid of this warning, but that's the problem with using the equivalent name of the remote branch when working in a branch locally? probably i miss some parameter to git-svn clone so that it would prefix the refs with some 'origin'? thanks, - VMiklos
Try using 'git svn rebase remotes/ooo-build-2-3'. git-svn should produce its branches under refs/remotes/* and your local branches are under refs/heads/*. By using 'git checkout -b ooo-build-2-3 ooo-build-2-3' you created refs/heads/ooo-build-2-3 as a copy of refs/remotes/ooo-build-2-3 and now using only ooo-build-2-3 is ambigious. (at least in some cases where git Look up --prefix in the manpage for git-svn. -Peter -
great, --prefix is what i missed. a related question: is it possible to avoid even the "remotes" prefix? it could be useful when creating an incremental import of an svn repo. (ie when using git-svn as a replacement of git-svnimport.) so after the clone, one will see all the svn branches as a remote branch, since they will be local (and not remote) ones in the mirror repo. thanks, - VMiklos
git svn init --stdlayout creates this entry in your .git/config per default
[svn-remote "svn"]
url = https://url/to/your/svn/repo
fetch = trunk:refs/remotes/trunk
branches = branches/*:refs/remotes/*
tags = tags/*:refs/remotes/tags/*
You could change this to
[svn-remote "svn"]
url = https://url/to/your/svn/repo
fetch = trunk:refs/remotes/origin/trunk
branches = branches/*:refs/remotes/origin/*
tags = tags/*:refs/remotes/origin/tags/*
to get what --prefix origin would do.
On the other hand you could forget completly the remote part by specifying
[svn-remote "svn"]
url = https://url/to/your/svn/repo
fetch = trunk:refs/heads/trunk
branches = branches/*:refs/heads/*
tags = tags/*:refs/heads/tags/*
but I advice you to not do this. refs/remotes has a special meaning in git,
e.g. you can't commit directly to it (which makes sense, because it only
tracks the state of the remote repo. On the other hand remote branches won't
get cloned per default.)
Side note, if you want to track only some branches, or if you have a strange
svn layout, you could use something like this:
[svn-remote "svn"]
url = https://url/to/your/svn/repo
fetch = trunk:refs/remotes/origin/trunk
fetch = branches/branchA:refs/remotes/origin/branchA
fetch = branches/branchB:refs/remotes/origin/branchB
...
-Peter
-
On Sat, Dec 08, 2007 at 05:56:57PM +0100, Peter Baumann <waste.manager@gmx.= yes, that's exactly what i want to do - in case the target is to convert an svn repo to a git one (and i need git-svn since git-svnimport is to be removed in 1.5.4) thanks, - VMiklos
On Sun, Dec 09, 2007 at 12:52:48AM +0100, Miklos Vajna <vmiklos@frugalware.=
hm, this seem to be not-working for me.
after "git svn init -s url" i edited the config:
$ cat .git/config
[core]
repositoryformatversion =3D 0
filemode =3D true
bare =3D false
logallrefupdates =3D true
[svn-remote "svn"]
url =3D svn+ssh://vmiklos@svn.gnome.org/svn/ooo-build
fetch =3D trunk:refs/master
branches =3D branches/*:refs/*
tags =3D tags/*:refs/tags/*
and wanted to fetch the revisions, but actually
$ git svn fetch
does not fetch any revisions. (yes, it does once i put back the
"remotes" prefix). is this a bug? :)
thanks,
- VMiklos
On Sun, Dec 09, 2007 at 03:13:36AM +0100, Bj=F6rn Steinbrink <B.Steinbrink@=
oh, right. here is my fixed config:
[svn-remote "svn"]
url =3D svn+ssh://vmiklos@svn.gnome.org/svn/ooo-build
fetch =3D trunk:refs/heads/master
branches =3D branches/*:refs/heads/*
tags =3D tags/*:refs/tags/*
git svn fetch still does not seem to do anything :S
thanks,
- VMiklos
I'm not sure if it's considered a "bug", but that's just the way it is at the moment. I can't remember why, but I did make git-svn force the presence of the "remotes/" prefix in all refs it writes to... -- Eric Wong -
okay, i see. one problem: git-svnimport is to be removed and (afaik) the supposed way is to use git-svn instead. what is the supposed way to use git-svn to convert an svn repo to a git one if the method i tried is not working? (if the branches are fetched to "remotes/" then they won't be visible when one clones the converted repo) thanks, - VMiklos
I'm pretty sure the reasoning behind "remotes/" being forced by git-svn was to prevent users from shooting themselves in the foot, since committing to those remote refs will break both git-svn fetch and dcommit... Heck, the entire "remotes/" idea started because a git-svn user made the mistake of committing to the remote tracking branch directly: http://thread.gmane.org/gmane.comp.version-control.git/16869/focus=16875 I'll consider accepting a patch to lift that restriction (but still use the "remotes/" by default, of course). Also, it's possible to fetch them after editing .git/config a little: Harvey Harrison's "[RFC] Mirroring svn" post has a good example on how to do it. http://mid.gmane.org/1196922153.10408.101.camel@brick Perhaps git-clone could gain the ability to clone refs/remotes/ as-is without an extra step? -- Eric Wong -
Something in the spirit of --mirror perhaps? --mirror-remotes sounds about right Harvey -
well, what i did for now is to use 2 repos. i use git-svn to create a
regular git-svn repo from svn, then an other one to create a regular git
repo from the git-svn one. this has one benefit: git-svn requires a
working tree, but i definitely want to publish only a bare repo. so here
is what i have in the bare repo's config:
[remote "origin"]
url = /path/to/git-svn/repo
fetch = +refs/remotes/origin/tags/*:refs/tags/*
fetch = +refs/remotes/origin/trunk:refs/heads/master
fetch = +refs/remotes/origin/*:refs/heads/*
then a simple git fetch will do what i need. i'm not entirely sure this
is the right think to do, but works for me :)
thanks,
- VMiklos
