git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Buchacher <drizzd@aon.at>
To: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
Cc: Finn Arne Gangstad <finnag@pvv.org>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: What's cooking extra
Date: Mon, 24 May 2010 11:49:05 +0200	[thread overview]
Message-ID: <20100524094905.GA10811@localhost> (raw)
In-Reply-To: <744D05D2-FC47-45E5-92A1-CD93B0901E0C@gmail.com>

On Sun, May 23, 2010 at 02:53:18PM +0200, Eyvind Bernhardsen wrote:
> On 23. mai 2010, at 13.51, Clemens Buchacher wrote:
> 
> > On Sun, May 23, 2010 at 12:36:51PM +0200, Eyvind Bernhardsen wrote:
> >> Yeah, that's what I initially thought too, but it makes sense to
> >> be able to use normalization to prevent line ending breakages in
> >> your repository.  If a file needs CRLFs for some tool to work,
> >> you don't want anyone to inadvertently convert it to LF, and
> >> "eol=crlf" makes git enforce that.
> > 
> > Unsetting crlf/text already disables converting it to LF. The user
> > would have to change the line endings in his work tree and commit
> > the file with wrong line endings. I do not see how this can happen
> > inadvertently.
> 
> That's because you don't use (or work with people who use)
> editors that mangle line endings without asking.

That I can imagine. But due to their change, the file will not work
any more, not even on their own platform. What did they even make
the change for then?

> I don't have strong feelings about the need for this feature, but
> it has been requested so it's probably useful.

Just because a feature is requested doesn't mean it's useful, or
even harmless. This has nothing to do with version control in the
first place, so I do not see why we should suffer the additional
complication.

> > No, I am aware of autocrlf=input, but apparently I did not
> > understand the meaning of eol=lf correctly. So if a file has CRLF
> > endings in the repository, and eol=lf, it will _not_ be converted
> > to LF in the work tree? Conversely, if it has LF endings in the
> > repository, and eol=crlf, it _will_ be converted to CRLF in the
> > work tree?
> 
> That is correct, but "eol=lf" means that the file _should_ be
> LF-only in the repository.  If it isn't, the repository is
> "corrupted".  Such a file is marked as dirty when it is checked
> out and will be normalized to LF-only line endings when it is
> committed, at which point the repository will be fixed.

With CRLF file in the repository, core.autocrlf=true and
core.eol=lf, I tested the patches currently in pu (0ed6711a) in the
following three scenarios:

1. no attributes are set
2. text attribute is set or auto
3. eol attribute is set to lf

In the first scenario, the behavior is completely asymmetric. LF
files will be converted to CRLF, if core.eol=crlf, but CRLF files
will _not_ be converted to LF, even if core.eol=lf. And it will not
be marked as dirty either. Yet this is the default behavior in
terms of attributes.

The only justification I can think of for this behavior is the fact
that on platforms with LF line endings, most tools can deal with
CRLF line endings. Not very convincing.

In the second scenario, the file is marked as dirty. Neither reset
--hard nor checkout HEAD . fix the problem. The file has to be
added and committed, after which the line endings are _still_ CRLF.
This appears to be the old autocrlf=true behavior. Is this
intentional?

The third scenario is similar to the second scenario, only it warns
me about CRLF conversion during add and commit. The file still ends
up having CRLF line endings in the work tree. git reset --hard does
not fix the line endings. touch'ing the file finally makes git diff
notice that the file is dirty, but git status still does not list
the file.

So to me, end of line conversion is still as confusing as it gets.

> This should only be a problem if you set the "text" or "eol"
> attributes in an existing repository, or if someone adds CRLFs to
> a normalized file using an older version of git.

In other words, this will be a problem all the time, since by
default people will not even know about text or eol.

Clemens

  parent reply	other threads:[~2010-05-24  9:49 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 14:33 What's cooking extra Junio C Hamano
2010-05-19 15:12 ` A Large Angry SCM
2010-05-19 17:06 ` Finn Arne Gangstad
2010-05-19 20:09   ` Eyvind Bernhardsen
2010-05-22 13:09   ` Clemens Buchacher
2010-05-22 19:42     ` Eyvind Bernhardsen
2010-05-22 22:27       ` Clemens Buchacher
2010-05-23 10:36         ` Eyvind Bernhardsen
2010-05-23 11:51           ` Clemens Buchacher
2010-05-23 12:53             ` Eyvind Bernhardsen
2010-05-23 13:26               ` Ævar Arnfjörð Bjarmason
2010-05-24  9:49               ` Clemens Buchacher [this message]
2010-05-24 12:47                 ` Dmitry Potapov
2010-05-24 20:45                   ` Eyvind Bernhardsen
2010-05-24 20:56                   ` Clemens Buchacher
2010-05-24 21:09                     ` Eyvind Bernhardsen
2010-05-24 21:11                 ` Eyvind Bernhardsen
2010-05-24 22:11                   ` Clemens Buchacher
2010-05-25  6:41                     ` Eyvind Bernhardsen
2010-05-25  8:27                       ` Anthony Youngman
2010-06-07 19:55                         ` Eyvind Bernhardsen
2010-05-25  8:33                       ` Clemens Buchacher
2010-05-24 12:12             ` Dmitry Potapov
2010-05-24 12:22               ` Erik Faye-Lund
2010-05-24 12:42                 ` Dmitry Potapov
2010-05-21 16:16 ` Ævar Arnfjörð Bjarmason
2010-05-22 21:24 ` René Scharfe
2010-05-22 21:26   ` [PATCH 1/8] grep: add test script for binary file handling René Scharfe
2010-05-22 21:28   ` [PATCH 2/8] grep: grep: refactor handling of binary mode options René Scharfe
2010-05-22 21:29   ` [PATCH 3/8] grep: --count over binary René Scharfe
2010-05-22 21:30   ` [PATCH 4/8] grep: --name-only " René Scharfe
2010-05-22 21:32   ` [PATCH 5/8] grep: use memmem() for fixed string search René Scharfe
2010-05-22 21:34   ` [PATCH 6/8] grep: continue case insensitive fixed string search after NUL chars René Scharfe
2010-05-22 21:35   ` [PATCH 7/8] grep: use REG_STARTEND for all matching if available René Scharfe
2010-05-22 21:43   ` [PATCH 8/8] grep: support NUL chars in search strings for -F René Scharfe

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=20100524094905.GA10811@localhost \
    --to=drizzd@aon.at \
    --cc=eyvind.bernhardsen@gmail.com \
    --cc=finnag@pvv.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).