Linux 上的 Eclipse eGit 拧紧行尾

Eclipse eGit on Linux screwing line endings

由于行尾的变化,提交看起来比应有的大很多。

我有git 4.6.1.201703071140

在使用egit之前,命令

git ls-files --eol

显示

i/mixed w/mixed attr/                   somefile

然后,通过 git 暂存视图在 Eclipse 中提交后,它是:

i/lf    w/mixed attr/                   somefile

另一个例子:

i/crlf  w/crlf  attr/                   somefile2

变成:

 i/lf    w/crlf  attr/                   somefile2

您可以看到 egit 正在将第一列更改为 i/lf。

在 GitHub 中,您可以使用 ?w=1 来抑制噪音,但我该如何解决问题本身?

git 配置

core.autocrlf=input
core.repositoryformatversion=0
core.filemode=true
core.logallrefupdates=true
remote.origin.url=https://github.com/plutext/docx4j.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.master.rebase=false

根据https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration

You can tell Git to convert CRLF to LF on commit but not the other way around by setting core.autocrlf to input.

您可能想改用 false