gpt4 book ai didi

EGit 比较将所有行显示为已更改

转载 作者:行者123 更新时间:2023-12-04 12:08:41 27 4
gpt4 key购买 nike

刚刚安装了 EGit 附带的 Eclipse 4.3 (Kepler)(我将其更新为 EGit 3.2.201312181205-r)和 Git for Windows .我在现有 Eclipse 工作区下的 Git for Windows Bash shell 中克隆了一个存储库,然后在 Eclipse 中将其作为项目导入。但是,如果我右键单击未更改的文件并选择比较 > HEAD 修订版,它会将所有行显示为不同。

在适用于 Windows bash shell 的 Git 中,文件上的 git diff 不显示任何内容。运行 od -c在 Git bash 中的文件上显示它具有 Windows 样式的行尾。

当我进入 Eclipse 的比较/补丁首选项并说忽略空格时,它没有显示任何差异。但我想了解为什么这是必要的。

这里真正比较的是什么?

最佳答案

这是 Egit 中的一个已知错误。 https://bugs.eclipse.org/bugs/show_bug.cgi?id=342372

即使在 Egit 3.4(计划于 2014 年 6 月发布)中,它也不会被修复。 Robin Stocker 在上述错误的副本中给出了这个建议:

Until this is implemented, I recommend this setup:

  1. For each Eclipse project, go to Properties > Resource and change "New text file line delimiter" to Other: Unix. Commit the resulting .settings/org.eclipse.core.runtime.prefs files.

  2. Don't configure any .gitattributes or "core.autocrlf" for Git. This means that files will have the same line endings in the working directory as in the repository. Git and EGit will not convert any file contents.

With 1., all new files that are created in Eclipse will have correct (LF) line endings, even when created by a user on Windows.

For files that are already in your repository with CRLF, you can fix them and commit the result. I recommend using dos2unix or fromdos on the command line.



然而,据报道 Egit 在导入项目时会忽略这些设置。 https://bugs.eclipse.org/bugs/show_bug.cgi?id=421364

所以看起来所有开发人员都需要自己检查行尾。但至少你不需要任何其他工具来解决这个问题。下 文件 Eclipse 中的菜单有一个:“将行分隔符转换为”。另请注意,单个项目和工作区设置中都有行结束设置。

对于项目:右键单击 -> 属性 -> 资源

对于工作区:窗口 -> 首选项 -> 常规 -> 工作区

关于EGit 比较将所有行显示为已更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20844198/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com