Re: [PATCH] docs: clarify how the text and text=auto attributes are different

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

 



On Thu, Apr 20, 2023 at 11:56:41PM -0600, Alex Henrie wrote:

Thanks for that, fully agree with comments from Junio.

>  Set::
>
> -	Setting the `text` attribute on a path enables end-of-line
> -	normalization and marks the path as a text file.  End-of-line
> -	conversion takes place without guessing the content type.
> +	Setting the `text` attribute on a path marks the path as a text
> +	file, which enables end-of-line normalization: When a matching file
> +	is added to the index, even if it has CRLF line endings in the
> +	working directory, the file is stored in Git with LF line endings.

Hm, I stumbled a little bit over the word "even" here.
But it makes things very clear, so this is good.


> +	However, if the file was already in Git with CRLF endings, no
> +	conversion is done.

But I think that this is wrong, unless I missed something.

Using
*.txt text
in .gitattributes
will convert CRLF into LF in the repo at the next git commit/git add

When you create a file with CRLF (no atttibutes), commit it into the repo,
and later add the attribute "text", the file may be reported as modified.
Not always. A `touch file.txt` typically asks Git to re-investigate things,
and it may show up as modified.
After a `git clone` it may be shown as modified or not.
End of side-note.

Setting




>
>  Unset::
>
> @@ -142,10 +145,9 @@ Unset::
>
>  Set to string value "auto"::
>
> -	When `text` is set to "auto", the path is marked for automatic
> -	end-of-line conversion.  If Git decides that the content is
> -	text, its line endings are converted to LF on checkin.
> -	When the file has been committed with CRLF, no conversion is done.
> +	When text is set to "auto", Git decides by itself whether the file
> +	is text or binary.  If it is text, line endings are converted as
> +	described above.  If it is binary, they are not.

Here we need to have the lines from above:

When text is set to "auto", Git decides by itself whether the file
is text or binary.  If it is text, line endings are converted as
described above.  If it is binary, they are not.
However, if the file was already in Git with CRLF endings, no
conversion is done.

I hope that I didn't messed up while reading this patch ?
Thanks again for bringing this up




[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