@@ -120,20 +120,19 @@ repository upon 'git add' and 'git commit'.
120
120
`text`
121
121
^^^^^^
122
122
123
- This attribute enables and controls end-of-line normalization. When a
124
- text file is normalized, its line endings are converted to LF in the
125
- repository. To control what line ending style is used in the working
126
- directory, use the `eol` attribute for a single file and the
127
- `core.eol` configuration variable for all text files.
128
- Note that setting `core.autocrlf` to `true` or `input` overrides
129
- `core.eol` (see the definitions of those options in
130
- linkgit:git-config[1]).
123
+ This attribute marks the path as a text file, which enables end-of-line
124
+ conversion: When a matching file is added to the index, the file's line
125
+ endings are normalized to LF in the index. Conversely, when the file is
126
+ copied from the index to the working directory, its line endings may be
127
+ converted from LF to CRLF depending on the `eol` attribute, the Git
128
+ config, and the platform (see explanation of `eol` below).
131
129
132
130
Set::
133
131
134
132
Setting the `text` attribute on a path enables end-of-line
135
- normalization and marks the path as a text file. End-of-line
136
- conversion takes place without guessing the content type.
133
+ conversion on checkin and checkout as described above. Line endings
134
+ are normalized to LF in the index every time the file is checked in,
135
+ even if the file was previously added to Git with CRLF line endings.
137
136
138
137
Unset::
139
138
@@ -142,10 +141,11 @@ Unset::
142
141
143
142
Set to string value "auto"::
144
143
145
- When `text` is set to "auto", the path is marked for automatic
146
- end-of-line conversion. If Git decides that the content is
147
- text, its line endings are converted to LF on checkin.
148
- When the file has been committed with CRLF, no conversion is done.
144
+ When `text` is set to "auto", Git decides by itself whether the file
145
+ is text or binary. If it is text and the file was not already in
146
+ Git with CRLF endings, line endings are converted on checkin and
147
+ checkout as described above. Otherwise, no conversion is done on
148
+ checkin or checkout.
149
149
150
150
Unspecified::
151
151
@@ -159,26 +159,29 @@ unspecified.
159
159
`eol`
160
160
^^^^^
161
161
162
- This attribute sets a specific line-ending style to be used in the
163
- working directory. This attribute has effect only if the `text`
164
- attribute is set or unspecified, or if it is set to `auto`, the file is
165
- detected as text, and it is stored with LF endings in the index. Note
166
- that setting this attribute on paths which are in the index with CRLF
167
- line endings may make the paths to be considered dirty unless
168
- `text=auto` is set. Adding the path to the index again will normalize
169
- the line endings in the index.
162
+ This attribute marks a path to use a specific line-ending style in the
163
+ working tree when it is checked out. It has effect only if `text` or
164
+ `text=auto` is set (see above), but specifying `eol` automatically sets
165
+ `text` if `text` was left unspecified.
170
166
171
167
Set to string value "crlf"::
172
168
173
- This setting forces Git to normalize line endings for this
174
- file on checkin and convert them to CRLF when the file is
175
- checked out.
169
+ This setting converts the file's line endings in the working
170
+ directory to CRLF when the file is checked out.
176
171
177
172
Set to string value "lf"::
178
173
179
- This setting forces Git to normalize line endings to LF on
180
- checkin and prevents conversion to CRLF when the file is
181
- checked out.
174
+ This setting uses the same line endings in the working directory as
175
+ in the index when the file is checked out.
176
+
177
+ Unspecified::
178
+
179
+ If the `eol` attribute is unspecified for a file, its line endings
180
+ in the working directory are determined by the `core.autocrlf` or
181
+ `core.eol` configuration variable (see the definitions of those
182
+ options in linkgit:git-config[1]). If `text` is set but neither of
183
+ those variables is, the default is `eol=crlf` on Windows and
184
+ `eol=lf` on all other platforms.
182
185
183
186
Backwards compatibility with `crlf` attribute
184
187
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0 commit comments