public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: Jason Cho <jason11choca@proton.me>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Why doesn't git core.eol=lf work?
Date: Sat, 12 Jul 2025 12:30:30 +0200	[thread overview]
Message-ID: <20250712103030.GA30568@tb-raspi4> (raw)
In-Reply-To: <QcbAE4JJXpU-NcQ1loYdHthi-nYA2ZXcuuetCHE_0N0fRi0mdaf90VaLk0Y2ehrnVzoZraYO7jLhB7Pl68_k4l3HCqkFVGuMOzZ26cHYkfc=@proton.me>

On Sat, Jul 12, 2025 at 09:45:39AM +0000, Jason Cho wrote:
> ```MINGW64 /tmp/summer-temp/dbeaver/docs ((e4219ccb38...))
> $ git log -1 --patch license_header.txt
> commit b5121d4a6e8f3f21079920180b0fb14ada6d3349
> Author: serge-rider <serge@jkiss.org>
> Date:   Thu Jan 10 21:56:55 2019 +0300
> 
>     License header update (2019)
> 
> diff --git a/docs/license_header.txt b/docs/license_header.txt
> index 86de505a18..d75b48e98e 100644
> --- a/docs/license_header.txt
> +++ b/docs/license_header.txt
> @@ -1,5 +1,5 @@
>     DBeaver - Universal Database Manager
> -   Copyright (C) 2010-2018 Serge Rider (serge@jkiss.org)
> +   Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)^M
> 
>     Licensed under the Apache License, Version 2.0 (the "License");
>     you may not use this file except in compliance with the License.
> 
> MINGW64 /tmp/summer-temp/dbeaver/docs ((a3f59b66ed...))
> $ git check-attr --all -- license_header.txt
> 
> MINGW64 /tmp/summer-temp/dbeaver/docs ((a3f59b66ed...))
> $ rm license_header.txt
> 
> MINGW64 /tmp/summer-temp/dbeaver/docs ((a3f59b66ed...))
> $ git -c core.autocrlf=false -c core.eol=lf checkout -f HEAD -- license_header.txt
> 
> MINGW64 /tmp/summer-temp/dbeaver/docs ((a3f59b66ed...))
> $ cat -A license_header.txt
>    DBeaver - Universal Database Manager^M$
>    Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)^M$
> ^M$
>    Licensed under the Apache License, Version 2.0 (the "License");^M$
>    you may not use this file except in compliance with the License.^M$
>    You may obtain a copy of the License at^M$
> 
> MINGW64 /tmp/summer-temp/dbeaver/docs ((a3f59b66ed...))
> $ git --version
> git version 2.47.0.windows.2
> ```
> 
> I ask git to force checkout license_header.txt with LF line ending, but `cat` tells me the file is checked out with CRLF. Why?
> 
Side note: Did you  ?
I would suspect that core.autocrlf=false switches off the CRLF handling.
And this could be a command line:
git -c core.autocrlf=input -c core.eol=lf checkout -f HEAD -- license_header.txt

But now to the real stuff:
It may be that your file had been commited with LF or mixed CRLF into the repo.
In this case will Git not change CRLF into LF at checkout.
What does
git ls-files --eol license_header.txt
give you ?

Beside that, I would recommend to set up a .gitatrributes file
and add it to the repo.
echo "* text=auto" >.gitattributes
git add --renormalize .
git commit -m "Normalize line endings"


  reply	other threads:[~2025-07-12 10:30 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 [this message]
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
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=20250712103030.GA30568@tb-raspi4 \
    --to=tboegi@web.de \
    --cc=git@vger.kernel.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