在 git svn fetch 期间解压树对象的致命错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/338164/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fatal error unpacking a tree object during a git svn fetch
提问by notascleveras
When running get svn fetch to pull the latest new branches from the upstream svn repository I got this error:
当运行 get svn fetch 从上游 svn 存储库中提取最新的新分支时,我收到此错误:
$ git svn fetch
fatal: failed to unpack tree object 5ecb324e8b8fcb918acb253f33edc6ce49e49e0d
read-tree 5ecb324e8b8fcb918acb253f33edc6ce49e49e0d: command returned error: 128
Now every attempt at git svn on that local repo results in the same error. Originally I was running git version 1.5.6.4_0 and after the error I tried updating to 1.6.0.2_2 and the problem still persists.
现在,在该本地存储库上对 git svn 的每次尝试都会导致相同的错误。最初我运行的是 git 版本 1.5.6.4_0,错误后我尝试更新到 1.6.0.2_2,但问题仍然存在。
Is there any way to clean up this corruption? A fresh git svn clone of the upstream repository is fine, but I'd like to preserve my existing setup. I've looked through the docs and googled for the problem with no luck.
有没有办法清理这种腐败?上游存储库的新 git svn 克隆很好,但我想保留我现有的设置。我已经浏览了文档并在没有运气的情况下用谷歌搜索了这个问题。
回答by David Ammouial
I had the same problem. It is due to a particular SVN revision that git-svn can't read or deal with somehow. Here is what i tried in order:
我有同样的问题。这是由于特定的 SVN 修订版导致 git-svn 无法读取或以某种方式处理。这是我按顺序尝试的:
- Rewind to a revision known to work:
git svn reset -r 42 - Retry the fetch:
git svn fetch— Fetches each revision starting from 42 until the guilty one (say 50), then shows the same error message. - Fetch the parent:
git svn fetch --parent— Don't ask me why. That fetches more revisions. No idea whether it's relevant though. - Retry the fetch:
git svn fetch— Still doesn't work. - Fetch each of the next revisions:
git svn fetch -r 50— Works.git svn fetch -r 51— While no error message, go on.git svn fetch -r xx— The error message shows up, it's the bad revision. Don't care.git svn fetch -r xx+1— Works.
- Retry the fetch:
git svn fetch— Works! Starts to fetch more revisions.
- 倒回到已知有效的修订版:
git svn reset -r 42 - 重试获取:
git svn fetch— 从 42 开始获取每个修订版本,直到有问题的版本(例如 50),然后显示相同的错误消息。 git svn fetch --parent找父母:——别问我为什么。这会获得更多的修订。不知道它是否相关。- 重试获取:
git svn fetch— 仍然不起作用。 - 获取每个下一个修订:
git svn fetch -r 50— 作品。git svn fetch -r 51— 虽然没有错误消息,但继续。git svn fetch -r xx— 显示错误消息,这是错误的修订版。别管。git svn fetch -r xx+1— 作品。
- 重试获取:
git svn fetch— 有效!开始获取更多修订。
The process ought to be cleaned up (probably near the first steps), but it worked for me, without having to start again with a fresh clone.
这个过程应该被清理(可能接近第一步),但它对我有用,而不必重新开始一个新的克隆。
回答by amaechler
I experienced the same error message after creating a new SVN branch. I was able to resolve the issue by deleting the complete ".git/svn" directory and fetching from SVN again:
创建新的 SVN 分支后,我遇到了相同的错误消息。我能够通过删除完整的“.git/svn”目录并再次从 SVN 获取来解决这个问题:
$ rm -rf .git/svn
$ git svn fetch
Rebuilding .git/svn/refs/remotes/trunk/.rev_map.1d5df120-ff1b-4f4f-af56-171ecbcc785d ...
This fetched all commits from SVN again and resolved the error.
这再次从 SVN 获取所有提交并解决了错误。
回答by Paul
The most likely cause for this is a file or commit (that the tree references) is corrupted or missing. Or the tree itself could be corrupted. Check with:
最可能的原因是文件或提交(树引用的)损坏或丢失。或者树本身可能已损坏。检查:
git fsck --unreachable HEAD $(cat .git/refs/heads/*)
This will show a bunch of "dangling" files, which you don't care about; corrupted files will report "Invalid SHA1" or some such thing. I don't know how a missing file would report. Remove any corrupt items and rsyncfrom your upstream repo to replace them.
这将显示一堆您不关心的“悬空”文件;损坏的文件会报告“无效的 SHA1”或类似的东西。我不知道丢失的文件会如何报告。删除任何损坏的项目并rsync从您的上游存储库中替换它们。

