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

发布于 2024-12-29 21:03:56 字数 523 浏览 0 评论 0原文

当我执行以下操作时:

$ 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 服务器配置为使用关键字扩展(文件类型 = text+k),并且问题文件的第 3 行有一个扩展关键字。我在第 1 行进行了更改。

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

When I do the following:

$ git-p4 submit

I wind up with the following error trace:

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) 

How can I recover from this situation and make a successful submission?

FWIW, our P4 server is configured to use keyword expansion (filetype = text+k) and there is an expanded keyword at line 3 of the problem file. I made a change at line 1.

I've tried removing the delta at line 1, but the error persists when I retry the git-p4 submit.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

说谎友 2025-01-05 21:03:56

发布这个问题后就弄清楚了。

诀窍是在 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

这有效。

Figured it out just after posting this question.

The trick was going in behind P4's back and stripping out the keyword expansion.

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

This worked.

妞丶爷亲个 2025-01-05 21:03:56

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

This bit me as well. The other option is to change the file type through the GUI tool or the command line so that it's no longer a text+k or text+ko file type (so expansion doesn't happen). If you do that, it will commit OK.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文