git-svn branch naming question

13 messages, 5 authors, 2016-06-15 · open the first message on its own page

git-svn branch naming question

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:43:57

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

Re: git-svn branch naming question

From: Peter Baumann <hidden>
Date: 2016-06-15 22:43:57

On Sat, Dec 08, 2007 at 02:04:38AM +0100, Miklos Vajna wrote:
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?
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
won't take refs/heads/ooo-build-2-3)

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?
See above.
probably i miss some parameter to git-svn clone so that it would prefix
the refs with some 'origin'?
Look up  --prefix in the manpage for git-svn.

-Peter

Re: git-svn branch naming question

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:43:57

On Sat, Dec 08, 2007 at 11:59:01AM +0100, Peter Baumann [off-list ref] wrote:
Look up  --prefix in the manpage for git-svn.
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

Re: git-svn branch naming question

From: Peter Baumann <hidden>
Date: 2016-06-15 22:43:57

On Sat, Dec 08, 2007 at 03:14:49PM +0100, Miklos Vajna wrote:
On Sat, Dec 08, 2007 at 11:59:01AM +0100, Peter Baumann [off-list ref] wrote:
quoted
Look up  --prefix in the manpage for git-svn.
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.)
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

Re: git-svn branch naming question

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:43:57

On Sat, Dec 08, 2007 at 05:56:57PM +0100, Peter Baumann [off-list ref] wrote:
 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.)
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

Re: git-svn branch naming question

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:43:57

On Sun, Dec 09, 2007 at 12:52:48AM +0100, Miklos Vajna [off-list ref] wrote:
quoted
  [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.)
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)
hm, this seem to be not-working for me.

after "git svn init -s url" i edited the config:

$ cat .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[svn-remote "svn"]
        url = svn+ssh://vmiklos@svn.gnome.org/svn/ooo-build
        fetch = trunk:refs/master
        branches = branches/*:refs/*
        tags = 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

Re: git-svn branch naming question

From: Björn Steinbrink <hidden>
Date: 2016-06-15 22:43:57

On 2007.12.09 03:05:10 +0100, Miklos Vajna wrote:
On Sun, Dec 09, 2007 at 12:52:48AM +0100, Miklos Vajna [off-list ref] wrote:
quoted
quoted
  [svn-remote "svn"]
        url = https://url/to/your/svn/repo
        fetch = trunk:refs/heads/trunk
                                 ^^^^^
quoted
quoted
        branches = branches/*:refs/heads/*
                                         ^^^^^
quoted
quoted
        tags = tags/*:refs/heads/tags/*
                                 ^^^^^
        url = svn+ssh://vmiklos@svn.gnome.org/svn/ooo-build
        fetch = trunk:refs/master
        branches = branches/*:refs/*
        tags = tags/*:refs/tags/*
Just a guess, but this seems pretty headless ;-)

Björn
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

Re: git-svn branch naming question

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:43:57

On Sun, Dec 09, 2007 at 03:13:36AM +0100, Björn Steinbrink [off-list ref] wrote:
quoted
        url = svn+ssh://vmiklos@svn.gnome.org/svn/ooo-build
        fetch = trunk:refs/master
        branches = branches/*:refs/*
        tags = tags/*:refs/tags/*
Just a guess, but this seems pretty headless ;-)
oh, right. here is my fixed config:

[svn-remote "svn"]
        url = svn+ssh://vmiklos@svn.gnome.org/svn/ooo-build
        fetch = trunk:refs/heads/master
        branches = branches/*:refs/heads/*
        tags = tags/*:refs/tags/*

git svn fetch still does not seem to do anything :S

thanks,
- VMiklos

Re: git-svn branch naming question

From: Eric Wong <hidden>
Date: 2016-06-15 22:43:57

Miklos Vajna [off-list ref] wrote:
On Sun, Dec 09, 2007 at 12:52:48AM +0100, Miklos Vajna [off-list ref] wrote:
quoted
quoted
  [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.)
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)
hm, this seem to be not-working for me.

after "git svn init -s url" i edited the config:

$ cat .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[svn-remote "svn"]
        url = svn+ssh://vmiklos@svn.gnome.org/svn/ooo-build
        fetch = trunk:refs/master
        branches = branches/*:refs/*
        tags = 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? :)
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

Re: git-svn branch naming question

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:43:57

On Sat, Dec 08, 2007 at 06:26:24PM -0800, Eric Wong [off-list ref] wrote:
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...
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

Re: git-svn branch naming question

From: Eric Wong <hidden>
Date: 2016-06-15 22:43:57

Miklos Vajna [off-list ref] wrote:
On Sat, Dec 08, 2007 at 06:26:24PM -0800, Eric Wong [off-list ref] wrote:
quoted
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...
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)
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

Re: git-svn branch naming question

From: Harvey Harrison <hidden>
Date: 2016-06-15 22:43:57

On Sat, 2007-12-08 at 19:26 -0800, Eric Wong wrote:
Perhaps git-clone could gain the ability to clone refs/remotes/ as-is
without an extra step?
Something in the spirit of --mirror perhaps?  

--mirror-remotes sounds about right

Harvey

Re: git-svn branch naming question

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:43:57

On Sat, Dec 08, 2007 at 07:26:08PM -0800, Eric Wong [off-list ref] wrote:
Perhaps git-clone could gain the ability to clone refs/remotes/ as-is
without an extra step?
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help