git svn clone:分支从 repo/ 移动到 repo/branches/ 和 "Malformed XML: no element found"

git svn clone: branches moved from repo/ to repo/branches/ and "Malformed XML: no element found"

在 Cygwin 下使用 git 2.8.2 和 svn 1.9.4,当使用 git svn clone 克隆我们的存储库时,我在某个提交时遇到了问题:

r3640 = eb94... (refs/remotes/svn/trunk)
Found possible branch point: https://.../repo/<branchname> => https://.../repo/branches/<branchname>, 3641
Initializing parent: refs/remotes/svn/<branchname>@3641
Error from SVN, (175009): Malformed network data: The XML response contains invalid XML: Malformed XML: no element found

观察 #1:当使用 -r3600:HEAD 进行克隆时,即从足够近的提交开始,操作会成功。繁琐的实验表明,在有问题的提交之前从大约 100 个修订开始克隆时会出现问题。

观察#2:这似乎只发生在上述形式的分支上:错误地在 repo root repo/<branchname> 中创建,然后移动到 repo/branches/<branchname>

问题是什么以及如何解决?

解决方案:扩大您的 --log-window-size 值(默认值:100)。

警告:更大的 window 大小会阻止获取包含许多新添加文件的提交:

  • window 提交 3961 个新文件后,7000 的大小反复失败
  • window 提交 4927 个新文件后 4000 的大小失败

受影响的提交中实际上有 8430 个新文件。

这一切都在 Cygwin 下进行,我无法在 Linux 上重现这些问题,因此您的情况可能会有所不同。


我注意到观察到的导致错误的修订距离与 git svn fetch --log-window-size 选项的默认值之间存在相似之处:均为 100。

使用 4000 的日志 window 解决了我的问题,others 使用更大的值来加速初始 clone/fetch 操作。

我已经通过从有问题的修订之前的 10 个修订中克隆并使用 --log-window-size=1 验证了这个问题——它再次失败了。

知道这是 git-svn 方面的预期行为还是错误会很有趣,因为 --log-window-size 被记录为加速 clone/fetching 操作,并且不是解决某些分支问题的必要条件。