Skip to contentSkip to conversation

Add "core.eol" config variable

PATCH New Eyvind Bernhardsen 9 participants 14 messages Jun 15, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 Add "core.eol" config variable

Introduce a new configuration variable, "core.eol", that allows the user to set which line endings to use for end-of-line-normalized files in the working directory. It defaults to "native", which means CRLF on Windows and LF everywhere else.

Note that "core.autocrlf" overrides core.eol. This means that

[core]
autocrlf = true

puts CRLFs in the working directory even if core.eol is set to "lf".

---
As Clemens Buchacher noted, "core.autocrlf" doesn't work as a generic "turn on automatic line ending normalization" setting since it doesn't always normalize line endings.

This is a replacement for the 'Add "core.eol" config variable' commit that's currently in pu (the last one in my series). Instead of implying that "core.autocrlf=true" is a replacement for "* text=auto", it makes explicit the fact that autocrlf is only for users who want to work with CRLFs in their working directory on a repository that doesn't have text file normalization. When it is enabled, "core.eol" is ignored.

Signature · 12 lines
Eyvind

 Documentation/config.txt        |   35 ++++++++++-------
 Documentation/gitattributes.txt |   28 +++++++------
 Makefile                        |    3 +
 cache.h                         |   13 ++++++
 config.c                        |   16 +++++++
 convert.c                       |   60 +++++++++++++++++-----------
 environment.c                   |    1 +
 t/t0026-eol-config.sh           |   83 +++++++++++++++++++++++++++++++++++++++
 8 files changed, 188 insertions(+), 51 deletions(-)
 create mode 100755 t/t0026-eol-config.sh
Documentation/config.txt +21 -14
index 207351b..5a0737a 100644
@@ -196,16 +196,13 @@ core.quotepath::
 	quoted without `-z` regardless of the setting of this
 	variable.
 
-core.autocrlf::
-	If true, makes git convert `CRLF` at the end of lines in text files to
-	`LF` when reading from the work tree, and convert in reverse when
-	writing to the work tree.  The variable can be set to
-	'input', in which case the conversion happens only while
-	reading from the work tree but files are written out to the work
-	tree with `LF` at the end of lines.  A file is considered
-	"text" (i.e. be subjected to the autocrlf mechanism) based on
-	the file's `text` attribute, or if `text` is unspecified,
-	based on the file's contents.  See linkgit:gitattributes[5].
+core.eol::
+	Sets the line ending type to use in the working directory for
+	files that have the `text` property set.  Alternatives are
+	'lf', 'crlf' and 'native', which uses the platform's native
+	line ending.  The default value is `native`.  See
+	linkgit:gitattributes[5] for more information on end-of-line
+	conversion.
 
 core.safecrlf::
 	If true, makes git check if converting `CRLF` is reversible when
@@ -219,7 +216,7 @@ core.safecrlf::
 	irreversible conversion but continue the operation.
 +
 CRLF conversion bears a slight chance of corrupting data.
-autocrlf=true will convert CRLF to LF during commit and LF to
+When it is enabled, git will convert CRLF to LF during commit and LF to
 CRLF during checkout.  A file that contains a mixture of LF and
 CRLF before the commit cannot be recreated by git.  For text
 files this is the right thing to do: it corrects line endings
@@ -243,15 +240,25 @@ converting CRLFs corrupts data.
 +
 Note, this safety check does not mean that a checkout will generate a
 file identical to the original file for a different setting of
-`core.autocrlf`, but only for the current one.  For example, a text
-file with `LF` would be accepted with `core.autocrlf=input` and could
-later be checked out with `core.autocrlf=true`, in which case the
+`core.eol` and `core.autocrlf`, but only for the current one.  For
+example, a text file with `LF` would be accepted with `core.eol=lf`
+and could later be checked out with `core.eol=crlf`, in which case the
 resulting file would contain `CRLF`, although the original file
 contained `LF`.  However, in both work trees the line endings would be
 consistent, that is either all `LF` or all `CRLF`, but never mixed.  A
 file with mixed line endings would be reported by the `core.safecrlf`
 mechanism.
 
+core.autocrlf::
+	Setting this variable to "true" is almost the same as setting
+	the `text` attribute to "auto" on all files except that text
+	files are not guaranteed to be normalized: files that contain
+	`CRLF` in the repository will not be touched.  Use this
+	setting if you want to have `CRLF` line endings in your
+	working directory even though the repository does not have
+	normalized line endings.  This variable can be set to 'input',
+	in which case no output conversion is performed.
+
 core.symlinks::
 	If false, symbolic links are checked out as small plain files that
 	contain the link text. linkgit:git-update-index[1] and
Documentation/gitattributes.txt +15 -13
index f091f08..fce203d 100644
@@ -99,7 +99,7 @@ This attribute enables and controls end-of-line normalization.  When a
 text file is normalized, its line endings are converted to LF in the
 repository.  To control what line ending style is used in the working
 directory, use the `eol` attribute for a single file and the
-`core.autocrlf` configuration variable for all text files.
+`core.eol` configuration variable for all text files.
 
 Set::
 
@@ -120,9 +120,9 @@ Set to string value "auto"::
 
 Unspecified::
 
-	If the `text` attribute is unspecified, git uses the `eol`
-	attribute and the `core.autocrlf` configuration variable to
-	determine if the file should be converted.
+	If the `text` attribute is unspecified, git uses the
+	`core.autocrlf` configuration variable to determine if the
+	file should be converted.
 
 Any other value causes git to act as if `text` has been left
 unspecified.
@@ -132,19 +132,19 @@ unspecified.
 
 This attribute sets a specific line-ending style to be used in the
 working directory.  It enables end-of-line normalization without any
-content checks, similar to setting the `text` attribute.
+content checks, effectively setting the `text` attribute.
 
 Set to string value "crlf"::
 
-	This setting forces git to normalize line endings on checkin
-	and convert them to CRLF when the file is checked out,
-	regardless of `text` and `core.autocrlf`.
+	This setting forces git to normalize line endings for this
+	file on checkin and convert them to CRLF when the file is
+	checked out.
 
 Set to string value "lf"::
 
 	This setting forces git to normalize line endings to LF on
 	checkin and prevents conversion to CRLF when the file is
-	checked out, regardless of `text` and `core.autocrlf`.
+	checked out.
 
 Backwards compatibility with `crlf` attribute
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -193,9 +193,7 @@ config variable "core.autocrlf" without changing any attributes.
 This does not force normalization of all text files, but does ensure
 that text files that you introduce to the repository have their line
 endings normalized to LF when they are added, and that files that are
-already normalized in the repository stay normalized.  You can also
-set `autocrlf` to "input" to have automatic normalization of new text
-files without conversion to CRLF in the working directory.
+already normalized in the repository stay normalized.
 
 If you want to interoperate with a source code management system that
 enforces end-of-line normalization, or you simply want all text files
@@ -207,7 +205,11 @@ attribute to "auto" for _all_ files.
 ------------------------
 
 This ensures that all files that git considers to be text will have
-normalized (LF) line endings in the repository.
+normalized (LF) line endings in the repository.  The `core.eol`
+configuration variable controls which line endings git will use for
+normalized files in your working directory; the default is to use the
+native line ending for your platform, or CRLF if `core.autocrlf` is
+set.
 
 NOTE: When `text=auto` normalization is enabled in an existing
 repository, any text files containing CRLFs should be normalized.  If
Makefile +3 -0
index 910f471..419532e 100644
@@ -224,6 +224,8 @@ all::
 #
 # Define CHECK_HEADER_DEPENDENCIES to check for problems in the hard-coded
 # dependency rules.
+#
+# Define NATIVE_CRLF if your platform uses CRLF for line endings.
 
 GIT-VERSION-FILE: FORCE
 	@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -989,6 +991,7 @@ ifeq ($(uname_S),Windows)
 	NO_CURL = YesPlease
 	NO_PYTHON = YesPlease
 	BLK_SHA1 = YesPlease
+	NATIVE_CRLF = YesPlease
 
 	CC = compat/vcbuild/scripts/clink.pl
 	AR = compat/vcbuild/scripts/lib.pl
cache.h +13 -0
index d1f669e..ac6bfbd 100644
@@ -568,6 +568,19 @@ enum auto_crlf {
 
 extern enum auto_crlf auto_crlf;
 
+enum eol {
+	EOL_UNSET,
+	EOL_CRLF,
+	EOL_LF,
+#ifdef NATIVE_CRLF
+	EOL_NATIVE = EOL_CRLF
+#else
+	EOL_NATIVE = EOL_LF
+#endif
+};
+
+extern enum eol eol;
+
 enum branch_track {
 	BRANCH_TRACK_UNSPECIFIED = -1,
 	BRANCH_TRACK_NEVER = 0,
config.c +16 -0
index b60a1ff..1479ee6 100644
@@ -461,6 +461,8 @@ static int git_default_core_config(const char *var, const char *value)
 
 	if (!strcmp(var, "core.autocrlf")) {
 		if (value && !strcasecmp(value, "input")) {
+			if (eol == EOL_CRLF)
+				return error("core.autocrlf=input conflicts with core.eol=crlf");
 			auto_crlf = AUTO_CRLF_INPUT;
 			return 0;
 		}
@@ -477,6 +479,20 @@ static int git_default_core_config(const char *var, const char *value)
 		return 0;
 	}
 
+	if (!strcmp(var, "core.eol")) {
+		if (value && !strcasecmp(value, "lf"))
+			eol = EOL_LF;
+		else if (value && !strcasecmp(value, "crlf"))
+			eol = EOL_CRLF;
+		else if (value && !strcasecmp(value, "native"))
+			eol = EOL_NATIVE;
+		else
+			eol = EOL_UNSET;
+		if (eol == EOL_CRLF && auto_crlf == AUTO_CRLF_INPUT)
+			return error("core.autocrlf=input conflicts with core.eol=crlf");
+		return 0;
+	}
+
 	if (!strcmp(var, "core.notesref")) {
 		notes_ref_name = xstrdup(value);
 		return 0;
convert.c +36 -24

141 lines not on this page · raw message

environment.c +1 -0
index db4a5e9..83d38d3 100644
@@ -40,6 +40,7 @@ const char *editor_program;
 const char *excludes_file;
 enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
 int read_replace_refs = 1;
+enum eol eol = EOL_UNSET;
 enum safe_crlf safe_crlf = SAFE_CRLF_WARN;
 unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
 enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
t/t0026-eol-config.sh new file +83 -0

83 lines not on this page · raw message

Signature · 1 line
1.7.1.5.g82828
#1 lore raw

PATCH 1/1 convert: The native line-ending is \r\n on MinGW

If you try this:

1. Install Git for Windows (from the msysgit project)
2. Put

[core]
autocrlf = false
eol = native

in your .gitconfig.
3. Clone a project with

*.txt text

in its .gitattributes.

Then with current git, any text files checked out have LF line endings, instead of the expected CRLF.

Cc Johannes Schindelin <[email protected]>
Cc Johannes Sixt <[email protected]>

---

Quoted 4 lines · Eyvind Bernhardsen

Introduce a new configuration variable, "core.eol", that allows the user to set which line endings to use for end-of-line-normalized files in the working directory. It defaults to "native", which means CRLF on Windows and LF everywhere else.

The following fixup has been sitting in my tree (but not tested on Windows) for a couple of weeks. Sensible?

I don't know what the right choice for Cygwin is; probably LF unless there is some way to detect the systemwide setting at run time.

 Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Makefile +1 -0
index 40fbcae..ba08051 100644
@@ -1125,6 +1125,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 		compat/win32/pthread.o
 	EXTLIBS += -lws2_32
 	PTHREAD_LIBS =
+	NATIVE_CRLF = YesPlease
 	X = .exe
 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
 	htmldir=doc/git/html/
Signature · 1 line
1.7.2.3
#2 lore raw

Re: [PATCH master] convert: The native line-ending is \r\n on MinGW

Quoted 30 lines · Jonathan Nieder

If you try this:

1. Install Git for Windows (from the msysgit project)
2. Put

[core]
autocrlf = false
eol = native

in your .gitconfig.
3. Clone a project with

*.txt text

in its .gitattributes.

Then with current git, any text files checked out have LF line endings, instead of the expected CRLF.

Cc Johannes Schindelin <[email protected]>
Cc Johannes Sixt <[email protected]>

---

Quoted 4 lines · Eyvind Bernhardsen

Introduce a new configuration variable, "core.eol", that allows the user to set which line endings to use for end-of-line-normalized files in the working directory. It defaults to "native", which means CRLF on Windows and LF everywhere else.

Quoted 5 lines

The following fixup has been sitting in my tree (but not tested on Windows) for a couple of weeks. Sensible?

I don't know what the right choice for Cygwin is; probably LF unless there is some way to detect the systemwide setting at run time.

Has anybody in Windows land any input? I don't think what I do before 1.7.3 in my tree would matter much, so I am not applying this myself.

#3 lore raw

Re: [PATCH master] convert: The native line-ending is \r\n on MinGW

Quoted 8 lines · Junio C Hamano
Quoted 5 lines · Jonathan Nieder
Quoted 5 lines

Introduce a new configuration variable, "core.eol", that allows the user to set which line endings to use for end-of-line-normalized files in the working directory. It defaults to "native", which means CRLF on Windows and LF everywhere else.

Quoted 8 lines
Quoted 5 lines

The following fixup has been sitting in my tree (but not tested on Windows) for a couple of weeks. Sensible?

I don't know what the right choice for Cygwin is; probably LF unless there is some way to detect the systemwide setting at run time.

Has anybody in Windows land any input? I don't think what I do before 1.7.3 in my tree would matter much, so I am not applying this myself.

Sorry for the late reply to this; I've only just noticed that I hadn't replied! ;-)

FWIW, I suspect that anything other than LF as the eol on Cygwin would be *insane*. ;-D

ATB,
Ramsay Jones

#4 lore raw

Re: [PATCH master] convert: The native line-ending is \r\n on MinGW

In reply to Junio C Hamano

I am on windows 7 Pro - mingwin

I decided to turn autocrlf to false and use .gitattributes instead and was bitten by this bug :

http://stackoverflow.com/questions/13531988/git-line-endings-renormalize-does-not-seem-to-checkout-the-right-line-endings

It took me 2 days to figure this out

Please fix

--
View this message in context: http://git.661346.n2.nabble.com/PATCH-v6-Add-core-eol-config-variable-tp5140844p7571889.html
Sent from the git mailing list archive at Nabble.com.

#5 lore raw

Re: [PATCH master] convert: The native line-ending is \r\n on MinGW

Quoted 6 lines · Mr_and_Mrs_D <the.ubik <at> gmail.com> writes:

I am on windows 7 Pro - mingwin

Quoted 7 lines

I decided to turn autocrlf to false and use .gitattributes instead and was

bitten by this bug :

http://stackoverflow.com/questions/13531988/git-line-endings-renormalize-

does-not-seem-to-checkout-the-right-line-endings

Quoted 6 lines

It took me 2 days to figure this out

Quoted 7 lines

Please fix

--

View this message in context: http://git.661346.n2.nabble.com/PATCH-v6-

Add-core-eol-config-variable-tp5140844p7571889.html

Quoted 3 lines

Sent from the git mailing list archive at Nabble.com.

+1, this is a significant issue downstream in Git for Windows:

https://github.com/msysgit/git/issues/57

Effectively this renders .gitattributes useless for the scenario of enforcing normalized line ending characters.

#6 lore raw

Re: [PATCH master] convert: The native line-ending is \r\n on MinGW

Quoted 6 lines · Brice Lambson <bricelam <at> live.com> writes:

+1, this is a significant issue downstream in Git for Windows:

https://github.com/msysgit/git/issues/57

Effectively this renders .gitattributes useless for the scenario of enforcing normalized line ending characters.

+100

Folks, the problem is still there, with the very latest Git built with MinGW on Windows. Having eol=native in gitattributes means *LF* EOLs on Windows/MinGW.

So, essentially, eol=native is completely broken. And this is the most useful option to put into gitattributes and share among those working on the project.

Currently, I have to put eol=crlf there, and that means that those working on Linux will end up with CRLF files in their working copies.

The link quoted above does contain an additional fix that resolves the problem.

Thanks,
--Tvangeste

#7 lore raw

Re: [PATCH master] convert: The native line-ending is \r\n on MinGW

Quoted 5 lines · Tvangeste
Quoted 4 lines · Brice Lambson <bricelam <at> live.com> writes:

+1, this is a significant issue downstream in Git for Windows:

https://github.com/msysgit/git/issues/57

Quoted 8 lines
Quoted 2 lines

Effectively this renders .gitattributes useless for the scenario of enforcing normalized line ending characters.

+100

Folks, the problem is still there, with the very latest Git built with MinGW on Windows. Having eol=native in gitattributes means *LF* EOLs on Windows/MinGW.

The patch in the thread you are responding to is v1.8.3-rc0~65, so as far as the upstream git.git is concerned the issue is closed, but I cannot say that inter-project coordination between us and Git for Windows are stellar (no we are not fighting against each other, but being less intimate with what the other is doing than we could be).

Judging from how the original thread ended:

http://thread.gmane.org/gmane.comp.version-control.git/148436/focus=221438

Eric and J6t (cc'ed) are aware of this patch that went into 1.8.3, so...

#8 lore raw

Re: [PATCH master] convert: The native line-ending is \r\n on MinGW

In reply to Junio C Hamano
Quoted 32 lines · Junio C Hamano
Quoted 30 lines · Jonathan Nieder

If you try this:

1. Install Git for Windows (from the msysgit project)
2. Put

[core]
autocrlf = false
eol = native

in your .gitconfig.
3. Clone a project with

*.txt text

in its .gitattributes.

Then with current git, any text files checked out have LF line endings, instead of the expected CRLF.

Cc Johannes Schindelin <[email protected]>
Cc Johannes Sixt <[email protected]>

---

Quoted 4 lines · Eyvind Bernhardsen

Introduce a new configuration variable, "core.eol", that allows the user to set which line endings to use for end-of-line-normalized files in the working directory. It defaults to "native", which means CRLF on Windows and LF everywhere else.

Quoted 8 lines
Quoted 5 lines

The following fixup has been sitting in my tree (but not tested on Windows) for a couple of weeks. Sensible?

I don't know what the right choice for Cygwin is; probably LF unless there is some way to detect the systemwide setting at run time.

Has anybody in Windows land any input? I don't think what I do before 1.7.3 in my tree would matter much, so I am not applying this myself.

Pinging MsysGit folk again ...

#9 lore raw

Re: [PATCH master] convert: The native line-ending is \r\n on MinGW

Quoted 37 lines · Junio C Hamano
Quoted 35 lines · Junio C Hamano
Quoted 33 lines · Jonathan Nieder

If you try this:

1. Install Git for Windows (from the msysgit project)
2. Put

[core]
autocrlf = false
eol = native

in your .gitconfig.
3. Clone a project with

*.txt text

in its .gitattributes.

Then with current git, any text files checked out have LF line endings, instead of the expected CRLF.

Cc Johannes Schindelin <[email protected]>
Cc Johannes Sixt <[email protected]>

---

Quoted 4 lines · Eyvind Bernhardsen

Introduce a new configuration variable, "core.eol", that allows the user to set which line endings to use for end-of-line-normalized files in the working directory. It defaults to "native", which means CRLF on Windows and LF everywhere else.

The following fixup has been sitting in my tree (but not tested on Windows) for a couple of weeks. Sensible?

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

I don't know what the right choice for Cygwin is; probably LF unless there is some way to detect the systemwide setting at run time.

Has anybody in Windows land any input? I don't think what I do before 1.7.3 in my tree would matter much, so I am not applying this myself.

Pinging MsysGit folk again ...

This is absolutely the right thing to do. However, stuff have changed a bit since the patch was written; this change now needs to go in config.mak.uname instead of config.mak.

#10 lore raw

Re: [PATCH master] convert: The native line-ending is \r\n on MinGW

Quoted 3 lines · Erik Faye-Lund

This is absolutely the right thing to do. However, stuff have changed a bit since the patch was written; this change now needs to go in config.mak.uname instead of config.mak.

Thanks for a quick response.

What's your preference? I could just ignore a patch I won't be able to test myself and have you guys carry it in your tree forever, but I do not think that is necessary for something small like this.

I think this is low impact enough that it can directly go to 'master' or even 'maint' if I were to apply to my tree.

Thanks.

-- >8 --
From: Jonathan Nieder <[email protected]>
Date: Sat, 4 Sep 2010 03:25:09 -0500
Subject: [PATCH] convert: The native line-ending is \r\n on MinGW

If you try this:

1. Install Git for Windows (from the msysgit project)

2. Put

[core]
autocrlf = false
eol = native

in your .gitconfig.

3. Clone a project with

*.txt text

in its .gitattributes.

Then with current git, any text files checked out have LF line endings, instead of the expected CRLF.

Cc Johannes Schindelin <[email protected]>
Cc Johannes Sixt <[email protected]>
---
 config.mak.uname | 1 +
 1 file changed, 1 insertion(+)
config.mak.uname +1 -0
index 9080054..d78fd3d 100644
@@ -507,6 +507,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 		compat/win32/dirent.o
 	EXTLIBS += -lws2_32
 	PTHREAD_LIBS =
+	NATIVE_CRLF = YesPlease
 	X = .exe
 	SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
Signature · 1 line
1.8.2.1-542-g3613165
#11 lore raw

Re: [PATCH master] convert: The native line-ending is \r\n on MinGW

Quoted 11 lines · Junio C Hamano
Quoted 3 lines · Erik Faye-Lund

This is absolutely the right thing to do. However, stuff have changed a bit since the patch was written; this change now needs to go in config.mak.uname instead of config.mak.

Thanks for a quick response.

What's your preference? I could just ignore a patch I won't be able to test myself and have you guys carry it in your tree forever, but I do not think that is necessary for something small like this.

I should probably clarify; conceptually, this is the right thing to do. Git for Windows is a Windows application, and should have CRLF as the native newline. I hadn't tested this patch myself, though. Our tree is currently way behind yours, and I tried to do a rebase, but it turned out much trickier than I was hoping for.

I've given it a go on top of your tree + some essential patches I'll need to get things to run, and it seems to do what it claims to do. However, I haven't been able to run the test-suite, because I need a bunch more patches from the msysGit-tree for that.

Quoted 3 lines

I think this is low impact enough that it can directly go to 'master' or even 'maint' if I were to apply to my tree.

I agree. I don't think we need it in maint; we don't track that branch for msysGit.

Quoted 49 lines

Thanks.

-- >8 --
From: Jonathan Nieder <[email protected]>
Date: Sat, 4 Sep 2010 03:25:09 -0500
Subject: [PATCH] convert: The native line-ending is \r\n on MinGW

If you try this:

1. Install Git for Windows (from the msysgit project)

2. Put

[core]
autocrlf = false
eol = native

in your .gitconfig.

3. Clone a project with

*.txt text

in its .gitattributes.

Then with current git, any text files checked out have LF line endings, instead of the expected CRLF.

Cc Johannes Schindelin <[email protected]>
Cc Johannes Sixt <[email protected]>
---
 config.mak.uname | 1 +
 1 file changed, 1 insertion(+)
config.mak.uname +1 -1
index 9080054..d78fd3d 100644
@@ -507,6 +507,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
                compat/win32/dirent.o
        EXTLIBS += -lws2_32
        PTHREAD_LIBS =
+       NATIVE_CRLF = YesPlease
        X = .exe
        SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
--
Quoted 2 lines

1.8.2.1-542-g3613165

Looks fine to me.

#12 lore raw

Re: [PATCH master] convert: The native line-ending is \r\n on MinGW

Am 16.04.2013 16:39, schrieb Erik Faye-Lund:

Quoted 19 lines · Junio C Hamano
Quoted 11 lines
Quoted 3 lines · Erik Faye-Lund

This is absolutely the right thing to do. However, stuff have changed a bit since the patch was written; this change now needs to go in config.mak.uname instead of config.mak.

Thanks for a quick response.

What's your preference? I could just ignore a patch I won't be able to test myself and have you guys carry it in your tree forever, but I do not think that is necessary for something small like this.

I should probably clarify; conceptually, this is the right thing to do. Git for Windows is a Windows application, and should have CRLF as the native newline. I hadn't tested this patch myself, though. Our tree is currently way behind yours, and I tried to do a rebase, but it turned out much trickier than I was hoping for.

Quoted 4 lines

I've given it a go on top of your tree + some essential patches I'll need to get things to run, and it seems to do what it claims to do. However, I haven't been able to run the test-suite, because I need a bunch more patches from the msysGit-tree for that.

I have been using this patch or an equivalent one since at least one and a half years (until a month or two ago, as I discovered today, but that is only by accident). But I do not use any text attributes or eol configuration, so I can only say that it does not regress this use case.

Quoted 7 lines
Quoted 4 lines

I think this is low impact enough that it can directly go to 'master' or even 'maint' if I were to apply to my tree.

I agree. I don't think we need it in maint; we don't track that branch for msysGit.

Yes, master is good enough.

Thanks.

Quoted 55 lines
Quoted 50 lines

Thanks.

-- >8 --
From: Jonathan Nieder <[email protected]>
Date: Sat, 4 Sep 2010 03:25:09 -0500
Subject: [PATCH] convert: The native line-ending is \r\n on MinGW

If you try this:

1. Install Git for Windows (from the msysgit project)

2. Put

[core]
autocrlf = false
eol = native

in your .gitconfig.

3. Clone a project with

*.txt text

in its .gitattributes.

Then with current git, any text files checked out have LF line endings, instead of the expected CRLF.

Cc Johannes Schindelin <[email protected]>
Cc Johannes Sixt <[email protected]>
---
 config.mak.uname | 1 +
 1 file changed, 1 insertion(+)
config.mak.uname +1 -1
index 9080054..d78fd3d 100644
@@ -507,6 +507,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
                compat/win32/dirent.o
        EXTLIBS += -lws2_32
        PTHREAD_LIBS =
+       NATIVE_CRLF = YesPlease
        X = .exe
        SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
--
Quoted 2 lines

1.8.2.1-542-g3613165

Looks fine to me.

#13 lore raw

Re: [PATCH master] convert: The native line-ending is \r\n on MinGW

Quoted 4 lines · Johannes Sixt
Quoted 2 lines

I agree. I don't think we need it in maint; we don't track that branch for msysGit.

Yes, master is good enough.

Thanks to all those involved. Applied.