git-p4 提交失败,并显示“Not a valid object name HEAD~261”
我有一个 git 存储库,我想将其镜像到 Perforce 存储库。我已经下载了 git-p4 脚本(没有给出弃用警告的最新版本),并且一直在使用它。我已经弄清楚如何从 Perforce 中提取更改,但当我尝试从 git 存储库同步更改时遇到错误。这是我到目前为止所做的:
git clone [email protected]:asdf/qwerty.git
git-p4 sync //depot/path/to/querty
git merge remotes/p4/master (there was a single README file...)
所以,我已经将源复制到一个干净的新主管,得到了一个看起来很漂亮的合并文件树,并且 git status
显示我已经完成了-日期。但是:
> git-p4 submit
fatal: Not a valid object name HEAD~261
Command failed: git cat-file commit HEAD~261
git 邮件列表上的这个帖子似乎是相关的,但我无法弄清楚他们对所有 A、B 和 C 做了什么。有人可以澄清“不是有效的对象名称”的含义,以及我可以采取什么措施来解决该问题吗?我想做的就是定期将 origin/master 快照到 Perforce 中;不需要完整的历史记录。谢谢。
I've got a git repository that I'd like to mirror to a Perforce repository. I've downloaded the git-p4 script (the more recent version that doesn't give deprecation warnings), and have been working with that. I've figured out how to pull changes from Perforce, but I'm getting an error when I try to sync changes from the git repo back. Here's what I've done so far:
git clone [email protected]:asdf/qwerty.git
git-p4 sync //depot/path/to/querty
git merge remotes/p4/master (there was a single README file...)
So, I've copied the origin to a clean, new director, got a lovely looking merged tree of files, and git status
shows I'm up-to-date. But:
> git-p4 submit
fatal: Not a valid object name HEAD~261
Command failed: git cat-file commit HEAD~261
This thread on the git mailing list seems to be relevant, but I can't figure out what they're doing with all the A, B, and Cs. Could someone please clarify what "Not a valid object name" means, and what I can do to fix the problem? All I want to do is to periodically snapshot the origin/master into Perforce; a full history is not required. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
9 年后,这个问题可能会随着 Git 2.23(2019 年第 3 季度)而消失。
请参阅 commit c3f2358(2019 年 5 月 28 日)作者:Mike Mueller (
mdymike
)。(由 Junio C Hamano --
gitster
-- 合并于 提交 add59c4,2019 年 6 月 17 日)9 years later, that issue might be gone with Git 2.23 (Q3 2019)
See commit c3f2358 (28 May 2019) by Mike Mueller (
mdymike
).(Merged by Junio C Hamano --
gitster
-- in commit add59c4, 17 Jun 2019)应该意味着遥控器的 HEAD 指向了错误的引用。
换句话说,当您在 git 存储库中执行 P4 导入时,由于 SHA1 不正确,因此无法从该 git 存储库提交到 P4。为什么?我不知道。
这就是为什么,在您提到的线程中,用户:
--import-local
将 P4 存储库克隆到 B 中(“导入到refs/heads/
,而不是 < code>refs/remotes"),修复 B 的
HEAD
以引用 B 中导入的 p4 主分支将 B 克隆到 C,一个非裸存储库(它的工作树不为空,您可以在其中工作)
B 仅用于初始导入。
其余的工作是在 C 中完成的(不存在 SHA1 不正确的问题),使用:
remotes/origin/*
)git-p4提交
should mean that somehow the remote's HEAD points to an incorrect reference.
In other word, when you do a P4 import in a git repo, there is no way to submit from that git repo to P4, because of an incorrect SHA1. Why? I don't know.
That is why, in the thread you mention, the user:
--import-local
("Import intorefs/heads/
, notrefs/remotes
"),fix the
HEAD
of B to reference the p4 master branch imported in Bclone B into C, a non-bare repo (its working tree is not empty, you can work in it)
B was only there for the initial import.
The rest of the work is done in C (which has no issue of incorrect SHA1) with:
git-p4 sync
(to declare in Cremotes/p4/master
in addition toremotes/origin/*
)git-p4 submit