Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is ignore-paths evaluated in git svn?

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.

like image 392
Matt McHenry Avatar asked May 04 '12 11:05

Matt McHenry


1 Answers

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.

like image 53
Matt McHenry Avatar answered Oct 03 '22 13:10

Matt McHenry