我想使用 git-svn 检查 Boost 库,我只想检查从 1.35 版本开始的主干和标签,即 tags/release/Boost_1_35 及以上。我的配置如下所示:
[svn-remote "svn"]
ignore-paths = ^tags/release/(?i:(?!boost)|[^/]*(?:beta|rc)|boost_(?:0|1_[1-2]|1_3[0-4]))[^/]*/
url = https://svn.boost.org/svn/boost
fetch = trunk:refs/remotes/svn/trunk
tags = tags/release/*:refs/remotes/svn/tags/*
但是,git fetch 仍然会获取大量不相关的标签,例如 svn/tags/version_0-9-10 或 svn/tags/version_0-9-10@44215。我想知道指定忽略路径以实现此效果的正确方法是什么。
顺便说一句:我读过How do I fetch/clone only a few branches using git-svn?但听起来不是可扩展的解决方案。
最佳答案
我已经设法对某些分支这样做了,但是由于 svn 中的标签实际上是分支,所以它应该是相同的:
在使用“-t 标签和 -b 分支”进行 git svn init 之后,我将 .git/config 编辑为:
[svn-remote "svn"]
... url, fetch and stuff ...
branches = branches/rel-2.1/*:refs/remotes/svn/branches/rel-2.1/*
branches = branches/rel-2.2/*:refs/remotes/svn/branches/rel-2.2/*
branches = branches/rel-2.3/*:refs/remotes/svn/branches/rel-2.3/*
branches = branches/rel-2.4/*:refs/remotes/svn/branches/rel-2.4/*
branches = branches/rel-2.5/*:refs/remotes/svn/branches/rel-2.5/*
我使用了一个简单的 python 代码来生成相关行并将其复制到 .git/config:
for x in range(1,6):
print branches = " branches/rel-2.{0}/*:refs/remotes/svn/branches/rel-2.{0}/*".format(x)
不如正则表达式可扩展,但这是我能找到的最好的。
关于git - 如何 git svn 只获取具有特定模式的分支/标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6915418/