From: Lidong Yan <yldhome2d2@gmail.com>
To: Jason Cho <jason11choca@proton.me>
Cc: Johannes Sixt <j6t@kdbg.org>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Why doesn't git core.eol=lf work?
Date: Sun, 13 Jul 2025 15:43:55 +0800 [thread overview]
Message-ID: <C41F422E-8C9D-4BC7-BA0B-57B7D13D6557@gmail.com> (raw)
In-Reply-To: <sAxC2ASixUyCVtsk22zrxI2vAeM546T7O2tyWIS2vv_TGFo2OXWegg8J_r0zGzo5bZOA-BrwHa5yjAv2-Ewusjv9Fa9YYocrRkaIfpxhv_c=@proton.me>
Jason Cho <jason11choca@proton.me> write:
>
>>
>> Since you posted `git diff` output, may I ask if your concern is
>> actually the ^M in the diff output, which you intend to fix with
>> automatic CRLF-to-LF conversion?
>>
>
> No, my intent is to find moved or duplicated text among files.
>
> Let's say license_header.txt has
>
> DBeaver - Universal Database Manager^M
> Copyright (C) 2010-2018 Serge Rider (serge@jkiss.org)
>
> and another.txt has
>
> DBeaver - Universal Database Manager
> Copyright (C) 2010-2018 Serge Rider (serge@jkiss.org)
>
> My tool doesn't think the two pieces of txt the same because of ^M.
>
> Although my tool can do normalization internally, if git checks out files to CRLF due to core.autocrlf=true, my tool is fighting against git. git shouldn't spend time converting to CRLF which is about to be converted back to LF by my tool.
>
> That's why I set core.autocrlf=false, and ask git to normalize files to LF.
>
> So the problem is that, conversion to LF is not happening.
I believe that it's impossible to check out CRLF from the index as LF.
You have to use your tool to do that.
The definition of core.eol=lf is here:
https://git-scm.com/docs/gitattributes/2.9.5#:~:text=Set,-to%20string%20value%20%22lf
This means that when you use git add to stage files, Git will convert
CRLF line endings to LF. However, when you check out files, Git will
leave the line endings unchanged.
Thanks,
Lidong
next prev parent reply other threads:[~2025-07-13 7:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <8jPyf4EU-z7W6OHX4j_kba2G-1c2RIDtgBcSkFjWSNhMuE6pxOOyxSGBnguoZvuDQSaJPypH0u1vLJf6FBX_ahUn3bBO_1DVscfOQm4Jovw=@proton.me>
2025-07-12 9:45 ` Why doesn't git core.eol=lf work? Jason Cho
2025-07-12 10:30 ` Torsten Bögershausen
2025-07-12 10:56 ` Jason Cho
2025-07-12 13:35 ` Johannes Sixt
2025-07-12 19:15 ` Jason Cho
2025-07-13 7:43 ` Lidong Yan [this message]
2025-07-13 14:08 ` Jason Cho
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C41F422E-8C9D-4BC7-BA0B-57B7D13D6557@gmail.com \
--to=yldhome2d2@gmail.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=jason11choca@proton.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox