6

I have a simple repo structure like this:

trunk
    code
    othercode
    doc
    misc
branches
    b1
        code
        othercode
        doc
        misc
    b2
tags
    t1
    t2

I'm trying to use git svn to clone it, but want to omit doc and misc on trunk + all tags and branches. However, the ignore-paths option isn't acting like I'd expect.

ignore-paths = (doc|misc)

Seems to work, but I'm worried that it would also exclude a path like trunk/code/proj1/doc/, which I want to keep.

ignore-paths = ^(doc|misc)

Does not work -- doc and misc are pulled in by the initial git svn fetch command. How do I get a working regex that'll only match against directories at the root like this? The man page does not say whether ignore-paths matches against the "relative" path that'll end up at the root of the git clone (doc, etc.) or the "full" path as seen in the SVN remote (branches/b1/doc etc.), or something else.

Matt McHenry
  • 20,009
  • 8
  • 65
  • 64

1 Answers1

9

It seems to match the full path in the SVN repository. This regex, which includes the trunk/tags/branches portion of the SVN path, did the trick:

ignore-paths = ^(trunk|tags/[^/]*|branches/[^/]*)/(doc|misc)/

In words: the path must start with one of:

  • trunk
  • tags/, perhaps followed by one path segment (not containing /)
  • branches/, perhaps followed by one path segment (not containing /)

... then path segment named doc or misc.

Matt McHenry
  • 20,009
  • 8
  • 65
  • 64
  • Is there a equival method for svn repos without svn layout? – Spenhouet Aug 18 '14 at 08:26
  • @besnep, if you mean "without *the standard* svn layout", then I think yes: since the regex is matched against the full path, you can use it regardless of how your repository is laid out. – Matt McHenry Aug 18 '14 at 11:40
  • @MattMcHenry, not exactly. I meant by "without svn layout" that there is absolut no layout. A versionsplit was made by svn-copy. No SVN layout is used. So no trunk, no branch... if i understand it right. – Spenhouet Aug 18 '14 at 11:56
  • @besnep, I think this probably warrants its own separate question; it's going to be hard to hash out in comments. – Matt McHenry Aug 18 '14 at 16:01
  • I could make a new separate question but befor that i would have to finde a solution to my other problem: http://stackoverflow.com/questions/25358628/how-to-git-svn-clone-full-history-despite-svn-copy – Spenhouet Aug 19 '14 at 06:29
  • can you explain your regex please? – Zennichimaro Sep 15 '17 at 03:34