发表文章

[Java] gitattributes 终止所有文本自动转换 At .gitattributes kill all text auto conversions[bc-java]

oh2mqk 2017-10-9 25

BC 源树上的一些文件有 CRLF 的结尾, 其他的有 LF,
可能是一些纯 CR ("DOS"、"UNIX" 和 "MAC" 样式);git 敢于
假设知道什么格式, 我希望我的所有源代码使用。
其结果是, 它然后声称, 因为它没有 autoconversion
在 "拉" 过程中, 工作区之间现在存在一些差异,
主资料库。 只有这样才能恢复神智, 避免脱发是
完全禁用该功能。
(在克隆过程中不发生转换, 但在拉过程中发生。

如何? 注释出 (#) 所有在. gitattributes 中带有 "text" 的行
当然, 它会禁用花哨的比较, 但理智更重要。

我写这张纸条, 显然, 在 bc-java 源树的根目录中的文件来自于存储库, 而不是本地创建的。

原文:

Some files at the BC source tree have CRLF endings, others have LF, and
probably some plain CR ("DOS", "UNIX", and "MAC" styles); git dares to
presume to know what format I want all my source codes to use.
The result is that it does then claim that because it did autoconversion
during pull, there is now some difference in between the workspace, and
master repository. Only way to restore sanity, and avoid hair loss is
to disable that feature entirely.
(No conversion happens during clone, but do happen during pull.)

How? Comment out (#) all lines with 'text' at the .gitattributes
Sure it will disable fancy diffing too, but sanity is more important.

I am writing this note, as apparently that file at the root of the bc-java source tree is coming from repository, and not created locally.

相关推荐
最新评论 (3)
peterdettman 2017-10-9
1

我们大致遵循以下建议: https://help.github.com/articles/dealing-with-line-endings 。最近在存储库中有几个 java 文件带有 CRLF 结尾;他们已经修好了我们希望存储库本身只包含 LF 的结尾。如果您正在使用 Windows, 我建议你设置核心. autocrlf = 真的, 也许是核心. 终止 = crlf (即使它应该是默认的), 因为在文本 = 自动设置时, 仍有一些 git 客户端无法正确选择本机停产. gitattributes。

原文:

We are following roughly the advice here: https://help.github.com/articles/dealing-with-line-endings . There were recently a few java files in the repository with CRLF endings; they have been fixed. We expect the repository itself to contain only LF endings. If you are working on Windows, I advise you to set core.autocrlf = true, and perhaps core.eol = crlf (even though it should be the default) since there appear to still be some git clients that fail to choose the native EOL correctly when text=auto is set in .gitattributes .

oh2mqk 2017-10-9
2

我的桌面是 Fedora 18 Linux, 但仍然不知何故, 系统是非常混淆什么样的行尾它应该做的。 事实上, 我个人不喜欢的想法, 源存储库 "知道" 什么格式文件应该是。
我从未见过它工作正常。

原文:

My desktops are Fedora 18 Linux, but still somehow the system is very much confused of what kind of line endings it should do. Actually I personally hate the idea that source repository "knows" what format files should be.
I have never seen it working properly.

peterdettman 2017-10-9
3

请看一下https://help.github.com/articles/dealing-with-line-endings#re-normalizing-a-repository : 实际上, 您只需要删除受影响的文件并重置。让我知道, 如果你的树仍然有问题, 一旦你把它复位。

关于这一问题的实质内容, 我们将暂时坚持. gitattributes。这对我们在 Linux 和 Windows 的内部 (一旦我们解决了一些暂时的问题) 很好。我们是相当新的 git, 但从我所看到的一切, 这已成为标准的方式来处理它。该文件实际上并没有迫使客户做任何事情, 只是建议他们提供此存储库的约定。

原文:

Take a look at https://help.github.com/articles/dealing-with-line-endings#re-normalizing-a-repository : really you should only need to remove the affected files and reset. Let me know if your tree still has problems once you've reset it.

As to the substance of this issue, we will be sticking with the .gitattributes for the moment. It's working fine for us internally across Linux and Windows (once we sorted out some teething problems). We are fairly new to git, but from everything I've read about it, this has become the standard way to handle it. That file doesn't actually compel clients to do anything, it merely advises them of the conventions for this repository.

返回
发表文章
oh2mqk
文章数
1
评论数
1
注册排名
60878