git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: Hans Meiser <brille1@hotmail.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Explanation of `eol` attribute doesn't seem correct for Windows machines
Date: Mon, 6 Nov 2023 17:21:25 +0100	[thread overview]
Message-ID: <20231106162125.GA31375@tb-raspi4> (raw)
In-Reply-To: <AS4P195MB15272FE283D0CF606A8B074EE2AAA@AS4P195MB1527.EURP195.PROD.OUTLOOK.COM>

On Mon, Nov 06, 2023 at 03:11:54PM +0000, Hans Meiser wrote:
> https://git-scm.com/docs/gitattributes#_eol
>
> claims that:
>
> ---
> Set to string value "crlf"
>
>     This setting converts the file’s line endings in the working directory to CRLF when the file is checked out.
> Set to string value "lf"
>
>     This setting uses the same line endings in the working directory as in the index when the file is checked out.
> ---
>
> I don't think this explanation is sufficient for files stored on Windows machines.
> A file might be stored with CRLF in the index.
> What happens then?

  >This setting uses the same line endings in the working directory
  >as in the index when the file is checked out.
  If you have a file commited with CRLF into the index, it will have CRLF in the working tree.
  If the file had been commited with LF into the index, it will have LF in the working tree.
  That is what the documentation tries to say, I think.

However, the above discussion is only valid, when the "text" attribute is defined.
Otherwise the eol attribute has no effect.
So you need something like
* text=auto
and/or
*.txt text
in your .gitattributes file


> And what happens when a file is added to the index with `core.autocrlf=input` on Windows machines?
Do you have a .gitattributes file ? Or not ?
Is the file a new one, or does it exist ?

In any way,
git ls-files --eol
may help to find out, what is in the index and what is in the workingtree.

  reply	other threads:[~2023-11-06 16:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 15:11 Explanation of `eol` attribute doesn't seem correct for Windows machines Hans Meiser
2023-11-06 16:21 ` Torsten Bögershausen [this message]
2023-11-07  0:23   ` Hans Meiser
2023-11-07 17:12     ` Torsten Bögershausen

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=20231106162125.GA31375@tb-raspi4 \
    --to=tboegi@web.de \
    --cc=brille1@hotmail.com \
    --cc=git@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).