git p4 submit fails

夙愿已清 提交于 2019-11-30 20:28:12

I figured it out. The issue is caused by the line endings. I retested the problem with a different file and in this case, the error is caused by the line endings of the file checked out in the perforce workspace being win-style crlf, and the line endings of the file in the git repo being unix style lf.

In this case, I checked out the file in perforce, ran dos2unix against it, and submitted that, then ran git p4 submit and it worked.

That's not the real solution. That's just workaround. I sent an e-mail to git's mailing list, asking for a fix. http://marc.info/?l=git&m=136630231402536&w=2

For me submitting worked after I set git config apply.ignorewhitespace change.

I think the error occurs because the git core.whitespace setting is restrictive per default:

The ones that are turned on by default are blank-at-eol, which looks for spaces at the end of a line; blank-at-eof, which notices blank lines at the end of a file; and space-before-tab, which looks for spaces before tabs at the beginning of a line.

(see http://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration)

Setting apply.ignorewhitespace change allows git apply to fix these errors. Changing the core.whitespace setting to be less restrictive should also fix the problem, but I have not tried this.

Note that git p4 submit may fail if you don't do a rebase. So be sure to run git p4 rebase before the submit.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!