git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Bash <bash@genarts.com>
To: git@vger.kernel.org
Subject: Git EOL Normalization
Date: Wed, 25 May 2011 11:20:06 -0400 (EDT)	[thread overview]
Message-ID: <29536877.39971.1306336806278.JavaMail.root@mail.hq.genarts.com> (raw)
In-Reply-To: <20833035.39857.1306334468204.JavaMail.root@mail.hq.genarts.com>

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

       reply	other threads:[~2011-05-25 15:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20833035.39857.1306334468204.JavaMail.root@mail.hq.genarts.com>
2011-05-25 15:20 ` Stephen Bash [this message]
2011-05-25 17:58   ` Git EOL Normalization Dmitry Potapov
2011-05-25 18:06     ` Stephen Bash
2011-05-26  6:02     ` Jakub Narebski
2011-05-26  7:20       ` Dmitry Potapov
2011-05-26 16:07       ` Junio C Hamano
2011-05-26 16:28         ` Stephen Bash
2011-05-31 15:01           ` Drew Northup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29536877.39971.1306336806278.JavaMail.root@mail.hq.genarts.com \
    --to=bash@genarts.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).