How to turn off git 1.7.8 overhead for binary files (.doc, .pdf, etc)

五迷三道 提交于 2019-12-05 01:37:08

问题


I used git 1.7.4 for working with large svn repo - it was ok.

I updated to git 1.7.8, and now, when I do "git svn dcommit" git do some superfluous work. In task manager, I see that it do about 1M of writes (I am using SSD, so it worries me). It shows warrnings for .pdf and .doc documents, which it didn't show for 1.7.4, for instance:

"c:/Users/..../AppData/Local/Temp/SOMEHASH_documentName.doc is not a Word document", "Error: PDF file is damaged - attempting to reconstruct xref table"

and there are many of such warnings, maybe about 200. And when git shows such warnings, I see that write count is increased in task manager.

It looks like git tries to do some "smart" proccessing of binary .pdf/.doc files. But I don't need this. Which config option I should change to turn off this superfluous work?


回答1:


For the Git for Windows 1.7.8 release a default viewer for doc and pdf files was added. This is done by modifying the system gitattributes file to associate the astextplain textconv filter with files with the docx extension. You can either edit the system version (in Program Files\Git\etc\gitattributes) or reset this in either your personal .gitattributes or the one for the repository.

To override the system setting for just this repository you can add to the .gitattributes file:

*.doc !diff
*.DOC !diff

which resets the diff attribute to unspecified for this files, restoring the pre 1.7.8 handling.



来源:https://stackoverflow.com/questions/9656552/how-to-turn-off-git-1-7-8-overhead-for-binary-files-doc-pdf-etc

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