git-p4正在吃我的图像文件 [英] git-p4 is eating my image files

查看:99
本文介绍了git-p4正在吃我的图像文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我可以使用git-p4从p4导入,没有任何问题。一切似乎工作,但我的PNG文件(也许是其他人)被损坏。



我已阅读有关gitattributes和行结束问题,但我没有做改变最终结果。破碎的图像。



我的属性文件是:
* .png binary



据我了解,git应该足够聪明,以便在没有此帮助的情况下发现png是一个二进制文件。



这是否与p4 -git将文件从Perforce中取出?



更新:这是在Windows上。我忘记了这一点很重要。 解决方案

PNG文件格式有一个标题,它专门用来查看程序如果没有,则导致失败。



PNG文件的8个字节是:89 50 4E 47 0D 0A 1A 0A,因为它们包含Unix换行符和Windows换行符 - 所以执行自动转换的程序将自动使PNG失效。 PNG签名理由

所以看来这确实是个问题;而不是假设Git是问题,请尝试查看来自Perforce的导入。 Perforce正在进行翻译,或者最初是在损坏的状态下进行检查的,并且克隆/更新量不足以解决原始问题。


So, I can import from p4 using git-p4 without any problem. Everything seems to work, but my PNG files (and perhaps others) are getting corrupted.

I've read about gitattributes and the line ending issues, but nothing I do seems to change the end result. Broken images.

My attributes file is: *.png binary

Any ideas? As I understand it, git is supposed to be smart enough to figure out that a png is a binary file without this help.

Is this something particular to do with how p4-git pulls the files out of Perforce?

Update: This is on Windows. I forgot that would be important.

解决方案

The PNG file format has a header which is specifically designed to look out for programs that do end conversion, and cause a failure if not.

The 8-bytes of a PNG file are: 89 50 4E 47 0D 0A 1A 0A, chosen specifically because they contain the Unix newline and the Windows newline - so programs doing auto-conversion will automatically invalidate the PNG. PNG Signature rationale

So it seems that this is indeed the problem; and rather than assuming that Git is the problem, try looking at the import from Perforce. Either Perforce is doing the translation, or it was initially checked in in a corrupted state, and no amount of cloning/updating will fix the original problem.

这篇关于git-p4正在吃我的图像文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆