【发布时间】:2019-07-16 05:08:56
【问题描述】:
根据the documentation on .gitattributes,text 启用行尾归一化:
text在路径上设置文本属性可启用行尾规范化并将路径标记为文本文件。在不猜测内容类型的情况下进行行尾转换。
我有项目中使用的扩展名列表(git ls-tree -r HEAD --name-only | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u 用于查找文件类型 - 来自 How can I find all of the distinct file extensions in a folder hierarchy?)。
有没有办法检查 git 将每个扩展正确识别为二进制/文本?是否需要明确指定文件类型,或者 Git 通常处理得很好?
【问题讨论】:
-
Git 本身并没有以这种方式使用扩展。 您可以通过将它们列在
.gitattributes文件中来使用它们,但默认情况下,Git 只是尝试根据文件中的数据来确定文件是二进制文件还是文本文件。
标签: git normalization gitattributes end-of-line