Git EOL Normalization

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

 



Hi all-

At the office we recently had a few commits flipping end-of-line characters on complete files so I spent some time decoding the man pages on eol, autocrlf, and the text attribute.  From the current man pages I generated the tables below and I'm wondering a) if my interpretation is correct, and b) if there's value in putting these somewhere in the Git wiki (page name suggestions welcome!)?

Here are the tables (warning: poor attempt at ascii art... sorry!):

Configuration variables:
+---------------+--------+--------------+---------------------+----------------+
| Property      | Value  | Check in/out | Applies to          | Does what      |
+---------------+--------+--------------+---------------------+----------------+
| core.eol      | native | check out    | files marked text   | set EOL to OS  |
|               |        |              |                     |    native      |
+---------------+--------+--------------+---------------------+----------------+
| core.eol      | LF     | check out    | files marked text   | set EOL to LF  |
+---------------+--------+--------------+---------------------+----------------+
| core.eol      | CRLF   | check out    | files marked text   | set EOL to CRLF|
+---------------+--------+--------------+---------------------+----------------+
| core.autocrlf | true   | check out    | detected text files | set EOL to CRLF|
+---------------+--------+--------------+---------------------+----------------+
|               |        |              | other files         | check out as is|
+---------------+--------+--------------+---------------------+----------------+
|               |        | check in     | detected text files | LF in repo,    |
|               |        |              |                     |   checkin LF   |
|               |        |              |                     | CRLF in repo,  |
|               |        |              |                     |   checkin CRLF |
+---------------+--------+--------------+---------------------+----------------+
|               |        |              | other files         | check in as is |
+---------------+--------+--------------+---------------------+----------------+
| core.autocrlf | input  | check in     | detected text files | LF in repo,    |
|               |        |              |                     |   checkin LF   |
|               |        |              |                     | CRLF in repo,  |
|               |        |              |                     |   checkin CRLF |
+---------------+--------+--------------+---------------------+----------------+
|               |        |              | other files         | check in as is |
+---------------+--------+--------------+---------------------+----------------+
| core.autocrlf | unset  | nothing                                             |
+---------------+--------+--------------+---------------------+----------------+

Git attributes:
+-----------+------------+--------------+---------------------+----------------+
| Attribute | Value      | Check in/out | Applies to          | Does what      |
+-----------+------------+--------------+---------------------+----------------+
| text      | set        | check in     | matching files      | set EOL to LF  |
+-----------+------------+--------------+---------------------+----------------+
|           | unset      | check in     | matching files      | check in as is |
+-----------+------------+--------------+---------------------+----------------+
|           | auto       | check in     | matching detected   | set EOL to LF  |
|           |            |              |   text files        |                |
+-----------+------------+--------------+---------------------+----------------+
|           |            |              | matching non-text   | check in as is |
|           |            |              |    files            |                |
+-----------+------------+--------------+---------------------+----------------+
|           | unspecified| check in     | delegate to core.autocrlf            | 
+-----------+------------+--------------+---------------------+----------------+
| eol       | LF         | check out    | matching files      | set EOL to LF  |
+-----------+------------+--------------+---------------------+----------------+
|           | CRLF       | check out    | matching files      | set EOL to CRLF|
+-----------+------------+--------------+---------------------+----------------+

The open questions for me are:
  1) what is the actual text file detection algorithm?
  2) what is the autocrlf LF/CRLF detection algorithm?
  3) how does autocrlf handle mixed line endings? (either in the working copy or repo)

Thanks,
Stephen

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]