git-svn: Use prefix by default?
- From
Thomas Ferris Nicolaisen <tfnico@gmail.com>
- Date
- Aug 22, 2013, 09:02 UTC
- Message-ID
- <CAEcj5uVRcXF+XADFvy_q2mbQOdWPZkz57q1vePOqroMbQw4+HA@mail.gmail.com>
I've recently been forced back into using git-svn, and while I was at it, I noticed that git-svn generally behaves a lot better when it is initialized using the --prefix option.
For example, I make a standard-layout svn clone:
$ git svn clone -s https://svn.company.com/repos/project-foo/
.. and end up with this .gitconfig:
[svn-remote "svn"]
url = https://svn.company.com/repos/
fetch = project-foo/trunk:refs/remotes/trunk
branches = project-foo/branches/*:refs/remotes/*
tags = project-foo/tags/*:refs/remotes/tags/*And my remote branches looks like this:
remotes/trunk
remotes/feat-barNow, let's say I want to work on the feat-bar branch, so I attempt to create a tracking branch by the same name:
$ git checkout feat-bar # will detach head $ git checkout remotes/feat-bar # will detach head $ git checkout -t remotes/feat-bar # fatal: Missing branch name; try -b $ git checkout -tb remotes/feat-bar # Branch remotes/feat-bar set up to track local branch master.
Well, that's not what I wanted.. So I end up doing it the good old-fashioned way:
$ git checkout -tb feat-bar remotes/feat-bar # works
Now I am up and rolling, but I get this warning with every checkout or rebase:
warning: refname 'feat-bar' is ambiguous.
So, let's see what happens when I create the svn clone using a --prefix=mirror/ instead. Here's the config:
[svn-remote "svn"]
url = https://svn.company.com/repos/
fetch = project-foo/trunk:refs/remotes/mirror/trunk
branches = project-foo/branches/*:refs/remotes/mirror/*
tags = project-foo/tags/*:refs/remotes/mirror/tags/*Here are my remote branches:
remotes/mirror/trunk
remotes/mirror/feat-barLet's create the tracking branch:
$ git checkout feat-bar # Branch feat-bar set up to track remote branch feat-bar from mirror.
Voila, worked on the first try. And no more warnings about ambiguous refnames.
So now my question is: If using a prefix is so healthy for git's branch tracking conventions, why doesn't git-svn default to use some prefix like 'origin' or something when initializing a git svn clone?
The examples were made using 1.8.1.2 on OSX by the way.