gpt4 book ai didi

git-p4 提交失败,返回 "Not a valid object name HEAD~261"

转载 作者:太空狗 更新时间:2023-10-29 14:21:29 24 4
gpt4 key购买 nike

我有一个 git 存储库,我想将其镜像到 Perforce 存储库。我已经下载了 git-p4 脚本(没有给出弃用警告的最新版本),并且一直在使用它。我已经弄清楚如何从 Perforce 中提取更改,但是当我尝试从 git 存储库同步更改时出现错误。这是我到目前为止所做的:

git clone git@github.com:asdf/qwerty.git
git-p4 sync //depot/path/to/querty
git merge remotes/p4/master (there was a single README file...)

所以,我已经将原点复制到一个干净的新目录中,得到了一个看起来很漂亮的 merge 文件树,并且 git status 显示我是最新的。但是:

> 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似乎是相关的,但我无法弄清楚他们对所有 A、B 和 C 做了什么。有人可以澄清“不是有效的对象名称”是什么意思,我可以做些什么来解决这个问题?我想做的就是定期将 origin/master 快照到 Perforce 中;不需要完整的历史记录。谢谢。

最佳答案

9 年后,这个问题可能会随着 Git 2.23(2019 年第 3 季度)而消失

参见 commit c3f2358 (2019 年 5 月 28 日)Mike Mueller (mdymike) .
(由 Junio C Hamano -- gitster -- merge 于 commit add59c4 ,2019 年 6 月 17 日)

p4 unshelve: fix "Not a valid object name HEAD0" on Windows

git p4 unshelve was failing with these errors:

fatal: Not a valid object name HEAD0
Command failed: git cat-file commit HEAD^0

(git version 2.21.0.windows.1, python 2.7.16)

The pOpen call used by git-p4 to invoke the git command can take either a string or an array as a first argument.
The array form is preferred because platform-specific escaping of special characters will be handled automatically.(https://docs.python.org/2/library/subprocess.html)
The extractLogMessageFromGitCommit method was, however, using the string form and so the caret (^) character in the HEAD^0 argument was not being escaped on Windows.
The caret happens to be the escape character, which is why the git command was receiving HEAD0.

The behaviour can be confirmed by typing ECHO HEAD^0 at the command- prompt, which emits HEAD0.

The solution is simply to use the array format of passing the command to fOpen, which is recommended and used in other parts of this code anyway.

关于git-p4 提交失败,返回 "Not a valid object name HEAD~261",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2692884/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com