git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Soffian <jaysoffian@gmail.com>
To: Walter Bright <boost@digitalmars.com>
Cc: git@vger.kernel.org
Subject: Re: noob user, want checkins to all be forced to LF terminated lines
Date: Tue, 3 Aug 2010 19:56:42 -0400	[thread overview]
Message-ID: <AANLkTim=avirVOZ99_Pgp1iLJQ_5J_1xpAad84boi_M3@mail.gmail.com> (raw)
In-Reply-To: <i30g2s$dpt$1@dough.gmane.org>

On Sat, Jul 31, 2010 at 2:32 AM, Walter Bright <boost@digitalmars.com> wrote:
> So I'm lost again. If the version in the repository is always converted to
> LF, then why do I need to set autocrlf=input ?

Let's start over. :-)

Before git-1.7.2, EOL conversion was rather insane. It's fixed in
1.7.2, so I'm going to start by explaining what happens with that
version and later.

Option 1 (text/eol attributes):

- Normally git will perform no EOL conversion. Files are committed
into the repo exactly as you see them in your checkout.

- To have git perform EOL conversion, you need to either explicitly
tell it which files are text, or let it autodetect. You normally do
this via the .gitattributes file using:

  <pattern> text

or

  * text=auto

In the former case, you're telling git explicitly which files are
text. In the latter case, you're telling git to do its best to detect
which files are text.

Files which are explicitly tagged as text, or auto-detected as text,
will have their EOLs converted to LF on check-in, and converted to
core.eol on check-out. core.eol defaults to "native" which means LF on
Unix and CRLF on Cygwin, but you can explicitly set it to "lf" or
"crlf" if you desire.

Certain files you may wish to specify their EOL in the working copy
explicitly. You do this with the eol attribute. e.g.:

  <pattern> eol=crlf
  <pattern> eol=lf

Files which are tagged with eol={crlf,lf} are implicitly text, and
will have their EOLs converted to LF on check-in, and converted to the
specified EOL on check-out.

Okay, so that's how you ensure that certain files have LFs in the
repo, and the desired EOL in the working-copy.

Option 2 (core.autocrlf):

With core.autocrlf=true, any files in the repo that git detects as
text and which already have LF EOLs will have their EOLs converted to
CRLF on check-out. Also, any additions to these files, or any new
files that git detects as text, will have their EOLs converted to LF
on check-in.

In this way, core.autocrlf=true is similar to "* text=auto", however
it does not affect any files in the repo which already have CRLF EOLs.

AFAIK, there's no reason to set core.autocrlf=true on Unix. You'd
typically only set it under Windows.

I'm going to stop here as I think these are the only options that make
sense with 1.7.2 and above. If you want me to explain your options
using earlier versions of git, I can try, but it's even more
confusing.

j.

  parent reply	other threads:[~2010-08-03 23:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-31  4:23 noob user, want checkins to all be forced to LF terminated lines Walter Bright
2010-07-31  4:49 ` Jonathan Nieder
2010-07-31  5:14   ` Walter Bright
2010-07-31  5:39     ` Ilari Liusvaara
2010-07-31  5:45       ` Walter Bright
2010-07-31  5:57         ` Ilari Liusvaara
2010-07-31  6:24           ` Walter Bright
2010-07-31 15:12             ` David Aguilar
2010-07-31  5:44     ` Jonathan Nieder
2010-07-31  6:32       ` Walter Bright
2010-07-31  6:41         ` Ilari Liusvaara
2010-07-31 20:38         ` Jonathan Nieder
2010-07-31 20:51           ` Walter Bright
2010-08-03 23:56         ` Jay Soffian [this message]
2010-08-04  5:29           ` Will Palmer
2010-07-31  5:41 ` Miles Bader

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='AANLkTim=avirVOZ99_Pgp1iLJQ_5J_1xpAad84boi_M3@mail.gmail.com' \
    --to=jaysoffian@gmail.com \
    --cc=boost@digitalmars.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).