Skip to content

Commit 8db2f66

Browse files
committed
Merge branch 'bc/clarify-eol-attr'
Doc and test update around the eol attribute. * bc/clarify-eol-attr: docs: correct documentation about eol attribute t0027: add tests for eol without text in .gitattributes
2 parents 2b9c120 + 8c591db commit 8db2f66

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Documentation/gitattributes.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,12 @@ unspecified.
160160
^^^^^
161161

162162
This attribute sets a specific line-ending style to be used in the
163-
working directory. It enables end-of-line conversion without any
164-
content checks, effectively setting the `text` attribute. Note that
165-
setting this attribute on paths which are in the index with CRLF line
166-
endings may make the paths to be considered dirty. Adding the path to
167-
the index again will normalize the line endings in the index.
163+
working directory. This attribute has effect only if the `text`
164+
attribute is set or unspecified, or if it is set to `auto` and the file
165+
is detected as text. Note that setting this attribute on paths which
166+
are in the index with CRLF line endings may make the paths to be
167+
considered dirty. Adding the path to the index again will normalize the
168+
line endings in the index.
168169

169170
Set to string value "crlf"::
170171

t/t0027-auto-crlf.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,12 @@ do
597597
# auto: core.autocrlf=false and core.eol unset(or native) uses native eol
598598
checkout_files auto "$id" "" false "" $NL CRLF CRLF_mix_LF LF_mix_CR LF_nul
599599
checkout_files auto "$id" "" false native $NL CRLF CRLF_mix_LF LF_mix_CR LF_nul
600+
# core.autocrlf false, .gitattributes sets eol
601+
checkout_files "" "$id" "lf" false "" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
602+
checkout_files "" "$id" "crlf" false "" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
603+
# core.autocrlf true, .gitattributes sets eol
604+
checkout_files "" "$id" "lf" true "" LF CRLF CRLF_mix_LF LF_mix_CR LF_nul
605+
checkout_files "" "$id" "crlf" true "" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
600606
done
601607

602608
# The rest of the tests are unique; do the usual linting.

0 commit comments

Comments
 (0)