git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Ferris Nicolaisen <tfnico@gmail.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: git-svn: Use prefix by default?
Date: Thu, 22 Aug 2013 11:02:05 +0200	[thread overview]
Message-ID: <CAEcj5uVRcXF+XADFvy_q2mbQOdWPZkz57q1vePOqroMbQw4+HA@mail.gmail.com> (raw)

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-bar

Now, 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-bar

Let'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.

             reply	other threads:[~2013-08-22  9:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-22  9:02 Thomas Ferris Nicolaisen [this message]
2013-09-30 22:39 ` git-svn: Use prefix by default? Johan Herland
2013-09-30 22:46   ` [RFC/PATCH] git svn: Set default --prefix='origin/' if --prefix is not given Johan Herland
2013-10-01  4:07     ` Eric Wong
2013-10-01  6:12       ` Johan Herland
2013-10-03 19:01         ` Eric Wong
2013-10-05 23:30           ` [RFC/PATCHv2 1/3] Documentation/git-svn: Promote the use of --prefix in docs + examples Johan Herland
2013-10-05 23:30             ` [RFC/PATCHv2 2/3] git-svn: Warn about changing default for --prefix in Git v2.0 Johan Herland
2013-10-09  1:34               ` Eric Sunshine
2013-10-09 12:18                 ` Johan Herland
2013-10-05 23:30             ` [RFC/PATCHv2 3/3] Git 2.0: git svn: Set default --prefix='origin/' if --prefix is not given Johan Herland
2013-10-06  9:51             ` [RFC/PATCHv2 1/3] Documentation/git-svn: Promote the use of --prefix in docs + examples Philip Oakley
2013-10-06 13:46               ` Johan Herland
2013-10-09  1:33             ` Eric Sunshine
2013-10-09 12:06               ` Johan Herland
2013-10-11 12:57             ` [RFC/PATCHv3 0/3] Change git-svn's default --prefix in Git v2.0 Johan Herland
2013-10-11 12:57               ` [RFC/PATCHv3 1/3] Documentation/git-svn: Promote the use of --prefix in docs + examples Johan Herland
2013-10-11 12:57               ` [RFC/PATCHv3 2/3] git-svn: Warn about changing default for --prefix in Git v2.0 Johan Herland
2013-10-12 22:33                 ` Eric Wong
2013-10-11 12:57               ` [RFC/PATCHv3 3/3] Git 2.0: git svn: Set default --prefix='origin/' if --prefix is not given Johan Herland
2014-04-19  8:32                 ` Eric Wong
2014-04-19  9:10                   ` [PATCH] git-svn.txt: Retain a description og pre-v2.0 default prefix Johan Herland
2014-04-19 11:43                     ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEcj5uVRcXF+XADFvy_q2mbQOdWPZkz57q1vePOqroMbQw4+HA@mail.gmail.com \
    --to=tfnico@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).