git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-svn does not support intermediate directories?

From
MLMichael Lai <myllai@gmail.com>
Date
Mar 4, 2009, 01:43 UTC
Message-ID
<21fc26450903031743x4beda8a3i835ecbd428817070@mail.gmail.com>
Hey all,
  After spending some hours struggling with git svn, it would appear
that it does not support svn projects stored in paths similar to
"http://foo.com/svn/repos/bar/myproject", where "myproject" uses the
standard SVN tags/trunk/branches layout.  I'm currently using git
1.6.1, though I tried this with 1.6.2-rc2 as well.  The resulting
.git/config looks something like this:
[svn-remote "svn"]
	url = http://foo.com/svn/repos/bar
	fetch = myproject/trunk:refs/remotes/trunk
	branches = bar/myproject/branches/*:refs/remotes/*
	tags = bar/myproject/tags/*:refs/remotes/tags/*

Yes, that's a redundant "bar" directory under "branches =" and "tags =". The issue seems to lie in git-svn doing something intelligent to extract the appropriate trunk directory. For the branches and tags, however, it just takes the full URL and removes the repository root (http://foo.com/svn/repos/bar) to produce "bar/myproject/{branches, tags}/*". The second effect is that "git svn fetch" will run but exit quietly without actually pulling anything from the repository. I tracked down an existing thread on the mailing list from a while ago (Feb 4th, title of "git-svn doesn't fetch anything"), but there was no resolution.

There is a quick workaround, which was to make this change to match_paths: < $self->{path_regex} ||= qr/^\/\Q$self->{path}\E\//; ---

> 	$self->{path_regex} ||= qr/\/\Q$self->{path}\E\//;

The additional "bar" directory gets pulled in when git-svn tries to determine what paths to pull down, and tries to match "/myproject/trunk" to "/bar/myproject/trunk". I've merely put a band-aid on the situation. My perl is rudimentary at best, or I'd have spent additional time to try to put in a "proper" patch, but was wondering if anyone else had run into this problem and would be willing to put in a fix (or point me in the right direction, that works too).

Thanks, Mike

Next: Tim Stoakes
Message 1 of 6 in “git-svn does not support intermediate directories?”
  1. Michael LaiMar 4, 2009
  2. Tim StoakesMar 4, 2009
  3. Michael LaiMar 6, 2009
  4. Eric WongMar 8, 2009
  5. Michael LaiMar 9, 2009
  6. Eric WongMar 9, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.