Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-svn clone checkouts wrong repo?

Tags:

git-svn

So I am trying to switch to git, by using git-svn. I am having a svn repo called myrepo from which I want to clone just the project called myproject. The thing is that by running the following command:

git svn clone path-to-repo/myrepo/myproject --stdlayout --prefix=svn myproject

the whole repo myrepo is cloned rather than just myproject. I tried using -T, -t, -b as well to let git know about the layout of the project, but without any success. I always get the following output:

Using higher level of URL: path-to-repo/myrepo/myproject => path-to-repo/myrepo

and tries to clone that one. Am I doing something wrong? It might be that the svn repo layout could be broken or git incompatible ?

like image 491
hyperboreean Avatar asked Sep 21 '09 08:09

hyperboreean


People also ask

How do I clone a Git repository in SVN?

# Clone a repo with standard SVN directory layout (like git clone): git svn clone http://svn.example.com/project --stdlayout --prefix svn/ # Or, if the repo uses a non-standard directory layout: git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/ # View all branches and tags you have ...

Can I use Git and SVN at the same time?

No interaction between them. Just ignore the . git folder for SVN and the . svn folder for Git and you should be fine.

Is SVN easier than Git?

SVN has one central repository – which makes it easier for managers to have more of a top down approach to control, security, permissions, mirrors and dumps. Additionally, many say SVN is easier to use than Git. For example, it is easier to create a new feature. With Git, it takes an extra step to create a new feature.


2 Answers

You can try the --no-minimize-url option.

According to http://schacon.github.com/git/git-svn.html:

--no-minimize-url

When tracking multiple directories (using --stdlayout, --branches, or --tags options), git svn will attempt to connect to the root (or highest allowed level) of the Subversion repository. This default allows better tracking of history if entire projects are moved within a repository, but may cause issues on repositories where read access restrictions are in place. Passing --no-minimize-url will allow git svn to accept URLs as-is without attempting to connect to a higher level directory. This option is off by default when only one URL/branch is tracked (it would do little good).

like image 110
kartikmohta Avatar answered Sep 27 '22 23:09

kartikmohta


Meanwhile, I got it working with the usual -s switch:

git svn clone -s <svn_repo_url>

I also have a few git-svn references that I want to share:

  1. http://justaddwater.dk/2009/03/09/using-git-for-svn-repositories-workflow/
  2. http://www.viget.com/extend/effectively-using-git-with-subversion/
  3. http://utsl.gen.nz/talks/git-svn/intro.html
  4. http://trac.parrot.org/parrot/wiki/git-svn-tutorial
like image 20
hyperboreean Avatar answered Sep 28 '22 00:09

hyperboreean