git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
To: git@vger.kernel.org
Cc: msysGit <msysgit@googlegroups.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Junio C Hamano <gitster@pobox.com>,
	Dmitry Potapov <dpotapov@gmail.com>,
	Robert Buck <buck.robert.j@gmail.com>,
	Finn Arne Gangstad <finnag@pvv.org>,
	Jay Soffian <jaysoffian@gmail.com>
Subject: [PATCH v3 0/5] End-of-line normalization, redesigned
Date: Thu, 13 May 2010 01:00:50 +0200	[thread overview]
Message-ID: <cover.1273700831.git.eyvind.bernhardsen@gmail.com> (raw)

After Finn Arne's bombshell of a patch, I was almost ready to throw in
the towel on this series.  Then I realized that just because autocrlf
is safe to use now doesn't mean it solves my CRLF-related problems.

The reason is that since autocrlf doesn't require your text files to
be normalized any more, it also doesn't guarantee that they are.  If
you need to interoperate with some other SCM, have tools that require
a specific line ending, or you just like your repository free of CR
characters, autocrlf doesn't do that.

This series does that.  There have been some changes since v2:

- Series is now based on Finn Arne's "safe autocrlf" patch (I took the
  one from "pu" since Junio seems to have fixed some whitespace
  damage).

- Removed core.eolStyle.  This gets more explanation below.

- Added "crlf=lf" and "crlf=crlf"; they turn on normalization and
  convert line endings to LF or CRLF on checkout, respectively.  Yes,
  I know.

- RFC patch: As promised, rename "crlf" attribute as "eolconv",
  keeping "crlf" as an alias for backwards compatibility.  I think
  this one might be worth it, but perhaps not as implemented (see the
  fix I made for git-cvsserver.perl to understand why).

- RFC patch: Rename "core.autocrlf" as "core.eolconv".  This one is
  mainly for fun, not so much for inclusion: it might have the same
  problems as adding an alias for "crlf" and I'm not too bothered
  about the name any more anyway, as I'll explain below.


So if I've removed eolStyle, how does the user say what line endings
to use for a normalized text file in the working directory?  Using
"core.autocrlf".  There are three reasons why that isn't completely
insane:

1. A user who wants CRLFs in text files probably doesn't want them
   just in files that happen to have normalized line endings.

2. You can force CRLF in the working directory now, so if you just
   want .vcproj files and the like to have CRLFs, you check in a
   .gitattributes containing "*.vcproj crlf=crlf" or add that line to
   your .git/info/attributes.  No need to use autocrlf at all.

3. With the "safe autocrlf" patch, core.autocrlf is actually safe to
   use in a non-normalized repository, so "core.autocrlf=true" is no
   longer an insane default.

Given the intended usage for autocrlf it's not even a particularly bad
name any more: "I don't care how you do it, I just want CRLFs in my
text files".  Even "autocrlf=input" isn't that bad if you squint a
bit.  After a few beers.

Summary: the new "core.autocrlf" is for when you don't want to mess up
an existing repository with unwanted CRLFs, and the new "crlf"
mechanisms are for normalizing text files.


Eyvind Bernhardsen (4):
  Add tests for per-repository eol normalization
  Add per-repository eol normalization
  Rename "crlf" attribute as "eolconv"
  Rename "core.autocrlf" config variable as "core.eolconv"

Finn Arne Gangstad (1):
  autocrlf: Make it work also for un-normalized repositories

 Documentation/config.txt        |   26 ++++---
 Documentation/gitattributes.txt |  157 ++++++++++++++++++++++++++++++---------
 attr.c                          |    2 +-
 cache.h                         |    9 ++-
 config.c                        |   13 ++-
 convert.c                       |  115 +++++++++++++++++++++++-----
 environment.c                   |    2 +-
 git-cvsserver.perl              |    8 ++-
 t/t0020-crlf.sh                 |  106 ++++++++++++++++++++++++++
 t/t0025-crlf-auto.sh            |  134 +++++++++++++++++++++++++++++++++
 10 files changed, 497 insertions(+), 75 deletions(-)
 create mode 100755 t/t0025-crlf-auto.sh

             reply	other threads:[~2010-05-12 23:02 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12 23:00 Eyvind Bernhardsen [this message]
2010-05-12 23:00 ` [PATCH v3 1/5] autocrlf: Make it work also for un-normalized repositories Eyvind Bernhardsen
2010-05-12 23:00 ` [PATCH v3 2/5] Add tests for per-repository eol normalization Eyvind Bernhardsen
2010-05-12 23:00 ` [PATCH v3 3/5] Add " Eyvind Bernhardsen
2010-05-12 23:00 ` [RFC/PATCH v3 4/5] Rename "crlf" attribute as "eolconv" Eyvind Bernhardsen
2010-05-13  1:38   ` Linus Torvalds
2010-05-13  9:39     ` Robert Buck
2010-05-13  9:58       ` Robert Buck
2010-05-13 11:47         ` Eyvind Bernhardsen
2010-05-13 13:19           ` Robert Buck
2010-05-14 10:16           ` utf8 BOM Dmitry Potapov
2010-05-15 20:23             ` Eyvind Bernhardsen
2010-05-16  5:19               ` Dmitry Potapov
2010-05-16 10:37                 ` Eyvind Bernhardsen
2010-05-16 11:26                   ` Tait
2010-05-16 13:32                     ` Dmitry Potapov
2010-05-13 10:59     ` [RFC/PATCH v3 4/5] Rename "crlf" attribute as "eolconv" Eyvind Bernhardsen
2010-05-13 21:45       ` Linus Torvalds
2010-05-14  2:34         ` Robert Buck
2010-05-14  4:56           ` Jonathan Nieder
2010-05-14 21:21             ` Eyvind Bernhardsen
2010-05-14 21:32           ` Eyvind Bernhardsen
2010-05-14 21:16         ` Eyvind Bernhardsen
2010-05-14 21:27           ` Linus Torvalds
2010-05-15 20:47             ` [PATCH] Add "core.eol" variable to control end-of-line conversion Eyvind Bernhardsen
2010-05-16 10:39               ` Robert Buck
2010-05-12 23:00 ` [RFC/PATCH v3 5/5] Rename "core.autocrlf" config variable as "core.eolconv" Eyvind Bernhardsen

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=cover.1273700831.git.eyvind.bernhardsen@gmail.com \
    --to=eyvind.bernhardsen@gmail.com \
    --cc=buck.robert.j@gmail.com \
    --cc=dpotapov@gmail.com \
    --cc=finnag@pvv.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jaysoffian@gmail.com \
    --cc=msysgit@googlegroups.com \
    --cc=torvalds@linux-foundation.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).