From: Will Palmer <wmpalmer@gmail.com>
To: Jay Soffian <jaysoffian@gmail.com>
Cc: Walter Bright <boost@digitalmars.com>, git@vger.kernel.org
Subject: Re: noob user, want checkins to all be forced to LF terminated lines
Date: Wed, 04 Aug 2010 06:29:35 +0100 [thread overview]
Message-ID: <1280899775.2820.4.camel@dreddbeard> (raw)
In-Reply-To: <AANLkTim=avirVOZ99_Pgp1iLJQ_5J_1xpAad84boi_M3@mail.gmail.com>
On Tue, 2010-08-03 at 19:56 -0400, Jay Soffian wrote:
> 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.
If it is accurate (and I have no way of knowing, since I've never
understood the ins-and-outs before), then that was the best, most
straightforward, most complete, least confusing description of
core.autocrlf, eol={crlf,lf}, and text=auto that I have ever read. I
want this post re-formatted and included in the docs :)
For completeness, would you mind explaining the "old way" too, and
include a note on oddities such as "git says my entire working copy has
changed, but reset --hard does nothing"? I just feel like I'm closer
than I've ever been to understanding the whole mess.
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
-- Will
next prev parent reply other threads:[~2010-08-04 5:29 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
2010-08-04 5:29 ` Will Palmer [this message]
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=1280899775.2820.4.camel@dreddbeard \
--to=wmpalmer@gmail.com \
--cc=boost@digitalmars.com \
--cc=git@vger.kernel.org \
--cc=jaysoffian@gmail.com \
/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).