git-p4提交失败,补丁不适用

esc*_*ten 7 git perforce git-p4

当我执行以下操作时:

$ git-p4 submit
Run Code Online (Sandbox Code Playgroud)

我最终得到以下错误跟踪:

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) 
Run Code Online (Sandbox Code Playgroud)

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

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

我已经尝试删除第1行的delta,但是当我重试git-p4提交时错误仍然存​​在.

esc*_*ten 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
Run Code Online (Sandbox Code Playgroud)

这很有效.