git-p4提交失败,提示“补丁不适用”。

7
当我执行以下操作时:
$ git-p4 submit

我得到了以下错误跟踪:
error: patch failed: foo/bar/blah.h:1
error: foo/bar/blah.h: patch does not apply
Unfortunately applying the change failed!
What do you want to do?
[s]kip this patch / [a]pply the patch forcibly and with .rej files / [w]rite the patch to a file (patch.txt) 

如何从这种情况中恢复并成功提交?

顺带一提,我们的P4服务器配置为使用关键词扩展(filetype = text + k),并且问题文件的第3行有一个扩展关键词。我在第1行做了更改。

我尝试删除第1行的增量,但当我重试git-p4提交时错误仍然存在。

2个回答

6

在发布这个问题后,我想明白了。

诀窍是绕过P4并去掉关键字扩展。

chmod +w foo/bar/blah.h
edit foo/bar/blah.h #change $File: //depot/foo/bar/blah.h$ to $File$
chmod -w foo/bar/blah.h
git-p4 submit

这个有效。

1
这也困扰了我。另一个选择是通过GUI工具或命令行更改文件类型,使其不再是"text+k"或"text+ko"文件类型(因此不会发生扩展)。如果这样做,它将提交成功。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接