Before this change,
$ echo "* text=auto" >.gitattributes
$ echo "* eol=crlf" >>.gitattributes
would have the same effect as
$ echo "* text" >.gitattributes
$ git config core.eol crlf
Since the 'eol' attribute had higher priority than 'text=auto', this may
corrupt binary files and is not what most users expect to happen.
Make the 'eol' attribute to obey 'text=auto' and now
$ echo "* text=auto" >.gitattributes
$ echo "* eol=crlf" >>.gitattributes
behaves the same as
$ echo "* text=auto" >.gitattributes
$ git config core.eol crlf
In other words,
$ echo "* text=auto eol=crlf" >.gitattributes
has the same effect as
$ git config core.autocrlf true
and
$ echo "* text=auto eol=lf" >.gitattributes
has the same effect as
$ git config core.autocrlf input
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Torsten Bögershausen9 years agocommitted byJunio C Hamano
@ -389,13 +389,11 @@ file with mixed line endings would be reported by the `core.safecrlf`
@@ -389,13 +389,11 @@ file with mixed line endings would be reported by the `core.safecrlf`
mechanism.
core.autocrlf::
Setting this variable to "true" is almost the same as setting
the `text` attribute to "auto" on all files except that text
files are not guaranteed to be normalized: files that contain
`CRLF` in the repository will not be touched. Use this
setting if you want to have `CRLF` line endings in your
working directory even though the repository does not have
normalized line endings. This variable can be set to 'input',
Setting this variable to "true" is the same as setting
the `text` attribute to "auto" on all files and core.eol to "crlf".
Set to true if you want to have `CRLF` line endings in your
working directory and the repository has LF line endings.
@ -115,6 +115,7 @@ text file is normalized, its line endings are converted to LF in the
@@ -115,6 +115,7 @@ text file is normalized, its line endings are converted to LF in the
repository. To control what line ending style is used in the working
directory, use the `eol` attribute for a single file and the
`core.eol` configuration variable for all text files.
This attribute sets a specific line-ending style to be used in the
working directory. It enables end-of-line normalization without any
working directory. It enables end-of-line conversion without any
content checks, effectively setting the `text` attribute.
Set to string value "crlf"::
@ -186,9 +188,10 @@ the working directory, and prevent .jpg files from being normalized
@@ -186,9 +188,10 @@ the working directory, and prevent .jpg files from being normalized
regardless of their content.
------------------------
* text=auto
*.txt text
*.vcproj eol=crlf
*.sh eol=lf
*.vcproj text eol=crlf
*.sh text eol=lf
*.jpg -text
------------------------
@ -198,7 +201,7 @@ normalization in Git.
@@ -198,7 +201,7 @@ normalization in Git.
If you simply want to have CRLF line endings in your working directory
regardless of the repository you are working with, you can set the
config variable "core.autocrlf" without changing any attributes.
config variable "core.autocrlf" without using any attributes.
test_expect_failure 'cherry-pick patch from after text=auto was added' '
@ -187,7 +194,7 @@ test_expect_failure 'cherry-pick patch from after text=auto was added' '
@@ -187,7 +194,7 @@ test_expect_failure 'cherry-pick patch from after text=auto was added' '