Re: idea to tweak wording of CRLF warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 26, 2021 at 05:31:53PM +0000, mark.yagnatinsky@xxxxxxxxxxxx wrote:
> If I'm on Windows and I "git add" a file with LF line endings, I get the following misleading warning:
>
> warning: LF will be replaced by CRLF in t.txt
>
> This makes me think something is about to happen "now" but actually the warning is about what will happen "later".
> In particular, the file will be committed with LF, but git may convert to CRLF when it comes time to check out the file.
> Thus, I propose to add the words "on checkout" somewhere in the warning message, to emphasize that the conversion will occur later instead of now.
> E.g., "warning, LF will be replaced by CRLF on next checkout of t.txt" or something along those lines.
>
> This suggestion was inspired by the amazingly detailed answer to my question on Stack overflow, without which I would have been badly confused:
> https://stackoverflow.com/questions/67199433/git-line-endings-behavior-does-not-match-documentation
>

Thanks for posting here.

I think/hope that a couple of answers given on stackoverflow could have digged out from here
(or may be they where ?)

About the gitattributes:
https://git-scm.com/docs/gitattributes

Out of curiosity, please allow a question:
Is that material too hard to understand, or too hard do find ?
Or does it take too much time to read ?

Back to the confusing message.
It is confusing even to me.

... I like that message suggestion. You might consider offering it to the Git mailing list as a patch to Git ...

It may be, that someone sends a patch.
However, as a very first step: "or something along those lines." needs to be defined.

Which short text would have explained the whole story better ?

The attributes with "* text=auto" means different things:
Files with CRLF in the working tree will get LF in the index,
when they are commited/added.

git checkout t.txt (which has LF) in your scenario
will not checkout the file with CRLF rigth now.
It is is not changed in the index.

A checkout will only change the working tree if you checkout t.txt with
different content - checkout a different branch, switch to a tag,
or checkout a commit id.

Or if you delete it in the working tree, and check it out again.

In that sense: Suggestions (the complete new text) of the warning message
are welcome.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux