2012-01-28 81 views
7

当我做到以下几点:的git-P4提交失败,补丁不适

$ 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) 

如何从这种情况下恢复和成功提交?

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

我试过在第1行除去delta,但是当我重试git-p4提交时,错误仍然存​​在。

回答

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+ktext+ko文件类型(因此不会发生扩展)。如果你这样做,它会确认。