What does “*.jpg binary -delta” do in the .gitattributes file?

好久不见. 提交于 2019-12-03 20:47:28
VonC

That could be related to:

Packing objects

delta

Delta compression will not be attempted for blobs for paths with the attribute delta set to false.

I detail delta storage in "Is the git binary diff algorithm (delta storage) standardized?".

That isn't set by default of binary files because:

our originally intended target audience are people who use git as a source code control system.

Jeff King adds:

I delta jpgs in one of my repositories. It is useful if the exif metadata changes but the image data does not. I assume you could do the same with other formats which have compressed and uncompressed portions (I also do it with video containers). I don't think it would ever make sense to try to delta gzip'd or bzip'd contents.

I also don't use "binary", as I use a custom diff driver instead (binary implies "-diff").

As for what should be the default, until now the default has always been that no gitattributes are defined by default. This is nice because it's simple to understand; git doesn't care about filenames unless you tell it to.
The downside obviously is that it may not perform optimally for some unusual workloads without extra configuration.

The .gitattributes man page mentions:

The simplest way to mark a file as binary is to unset the diff attribute in the .gitattributes file:

*.ps -diff

This will cause Git to generate Binary files differ (or a binary patch, if binary patches are enabled) instead of a regular diff.

So, yes "Setting the "binary" attribute also unsets the "text" and "diff" attributes as above", but Jeff was saying it was using only -diff in his case, which was enough to lark the file as binary.

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