How do Git SVN ignore-paths work (ignoring daily b

2019-03-11 07:48发布

I am trying clone an svn repository using git svn. The repository has daily builds tagged which I want to ignore. I am trying to use the "ignore-paths" option to do that, but I am still getting the daily build tags as branches in my repository.

A very recent and similar (but so far unanswered) question is here: How to git svn fetch only branches/tags with certain patterns?

Repository Layout - https://test.kuali.org/svn/rice

General Repository Structure

  • branches
    • Branch 1
  • Ignore Directory 1
  • Ignore Directory 1
  • tags
    • Tag 1
    • Tag 2
    • old
      • Old Tag 1
      • Old Tag 2
    • builds
      • Daily build 1
      • Daily build 2
  • trunk

What I have Tried

I am not that great at regular expressions, and they might be wrong, but here is what I've tried:

This was just a modified version of something I found in the git svn documentation:

git svn clone -r15709:HEAD --prefix=svn/ --stdlayout --no-follow-parent --ignore-paths="^[^/]+/(?:tags/builds|tags/old|branches)" https://test.kuali.org/svn/rice

This was me trying to simplify:

git svn clone -r15709:HEAD --prefix=svn/ --stdlayout --no-follow-parent --ignore-paths="(old|builds)" https://test.kuali.org/svn/rice rice-full

Desperation... (and adding some other paths I didn't need)

git svn clone -r15711:HEAD --prefix=svn/ --stdlayout --ignore-paths="^[^/]+/(?:builds|old)|inactive|rice-functional-tests|sandbox|tools" https://test.kuali.org/svn/rice

Then I switched to a more recent revision so it would finish sooner and tried ignoring all branches and tags for a test. This one seemed not to get any branches and tags, but it also never finished. It seemed to freeze (at least, it ran longer than I thought it should have for only getting a day or two of history):

git svn clone -r21846:HEAD --prefix=svn/ --stdlayout --ignore-paths="^tags*|^branches*" https://test.kuali.org/svn/rice

The last one I tried was:

git svn clone -r15711:HEAD --prefix=svn/ --stdlayout --ignore-paths="^tags/old*|^tags/builds*|^inactive*|^rice-functional-tests*|^sandbox*|^tools*" https://test.kuali.org/svn/rice

General Thoughts and Questions

  1. I'm not sure exactly what the ignore-paths regular expression is matching against. Is it the relative path of the svn repository (tags/builds/Daily build 1)? Is it evaluated for each file in the project (tags/builds/Daily build 1/file 1, tags/builds/Daily build 1/file 2) or just at the branch/tag level (tags/builds/Daily build 1)? Does it include the repository base url (https://test.kuali.org/svn/rice/tags/builds/Daily build 1)?

  2. Is there something I should be doing other than --stdlayout (specifying a regular expression for the tags that would get what I want)?

  3. I am only interested in trunk and certain release tags. Is there a better way to get those? I have tried cloning with only trunk, then adding a "fetch=" in the config to add only the tags I care about, then fetch the revision those were tagged from, but when I look at the result in git gui (visualize all branches) the two tags show up as floating with a single commit (not tied to trunk or each other).

Not sure if it is relavant, but I am using msysgit (git version 1.7.3.1.msysgit.0) on a windows 7 64 bit machine.

Long question, I know... I just wanted to be thorough.

1条回答
放荡不羁爱自由
2楼-- · 2019-03-11 08:37

It might be easier to just clone the trunk and nothing else (git svn clone -T http://path/to/trunk), and then add the specific tags and branches you want by modifying the config file and doing git svn fetches.

查看更多
登录 后发表回答