Push the NATIVE_CRLF Makefile variable to C and added a test for native.
PATCH 1/1 Push the NATIVE_CRLF Makefile variable to C and added a test for native.
Commit 95f31e9a correctly points out that the NATIVE_CRLF setting is incorrectly set on Mingw git. However, the Makefile variable is not propagated to the C preprocessor and results in no change. This patch pushes the definition to the C code and adds a test to validate that when core.eol as native is crlf, we actually normalize text files to this line ending convention when core.autocrlf is false.
---
(This is from MINGW, and some part of my brain thougth that this was send upstream, but it wasn't. Only 95f31e9a is in git.git)
Makefile | 3 +++ t/t0026-eol-config.sh | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+)
Makefile +3 -0
@@ -1481,6 +1481,9 @@ ifdef NO_REGEX COMPAT_CFLAGS += -Icompat/regex COMPAT_OBJS += compat/regex/regex.o endif +ifdef NATIVE_CRLF + BASIC_CFLAGS += -DNATIVE_CRLF +endif ifdef USE_NED_ALLOCATOR COMPAT_CFLAGS += -Icompat/nedmalloc
t/t0026-eol-config.sh +18 -0
@@ -80,4 +80,22 @@ test_expect_success 'autocrlf=true overrides unset eol' ' test -z "$onediff" && test -z "$twodiff" ' +test_expect_success NATIVE_CRLF 'eol native is crlf' ' + + rm -rf native_eol && mkdir native_eol && + ( cd native_eol && + printf "*.txt text\n" > .gitattributes + printf "one\r\ntwo\r\nthree\r\n" > filedos.txt + printf "one\ntwo\nthree\n" > fileunix.txt + git init && + git config core.autocrlf false && + git config core.eol native && + git add filedos.txt fileunix.txt && + git commit -m "first" && + rm file*.txt && + git reset --hard HEAD && + has_cr filedos.txt && has_cr fileunix.txt + ) +' + test_done
Signature · 1 line
2.1.0.rc2.210.g636bceb
Quoted 38 lines · Torsten Bögershausen
Commit
95f31e9acorrectly points out that theNATIVE_CRLFsetting is incorrectly set on Mingw git. However, theMakefilevariable is not propagated to the C preprocessor and results in no change. This patch pushes the definition to the C code and adds a test to validate that when core.eol as native is crlf, we actually normalize text files to this line ending convention when core.autocrlf is false.Signed-off-by Pat Thoyts <[email protected]>Signed-off-by Stepan Kasal <[email protected]>Signed-off-by Torsten Bögershausen <[email protected]>---
(This is from MINGW, and some part of my brain thougth that this was send upstream, but it wasn't. Only
95f31e9ais in git.git)Makefile | 3 +++ t/t0026-eol-config.sh | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+)Makefile +3
-0@@ -1481,6 +1481,9 @@ ifdef NO_REGEX COMPAT_CFLAGS += -Icompat/regex COMPAT_OBJS += compat/regex/regex.o endif +ifdef NATIVE_CRLF + BASIC_CFLAGS += -DNATIVE_CRLF +endif ifdef USE_NED_ALLOCATOR COMPAT_CFLAGS += -Icompat/nedmalloct/t0026-eol-config.sh +0
-0
t/t0026-eol-config.sh test_expect_success 'autocrlf=true overrides unset eol' ' · line 89
Quoted 10 lines
t/t0026-eol-config.sh +7
-0@@ -80,4 +80,22 @@ test_expect_success 'autocrlf=true overrides unset eol' ' test -z "$onediff" && test -z "$twodiff" ' +test_expect_success NATIVE_CRLF 'eol native is crlf' ' + + rm -rf native_eol && mkdir native_eol && + ( cd native_eol && + printf "*.txt text\n" > .gitattributes + printf "one\r\ntwo\r\nthree\r\n" > filedos.txt + printf "one\ntwo\nthree\n" > fileunix.txt
Broken &&-chain (3 lines).
Quoted 14 lines
t/t0026-eol-config.sh +11
-1+ git init && + git config core.autocrlf false && + git config core.eol native && + git add filedos.txt fileunix.txt && + git commit -m "first" && + rm file*.txt && + git reset --hard HEAD && + has_cr filedos.txt && has_cr fileunix.txt + ) +' + test_done --2.1.0.rc2.210.g636bceb
Quoted 38 lines · Torsten Bögershausen
Commit
95f31e9acorrectly points out that theNATIVE_CRLFsetting is incorrectly set on Mingw git. However, theMakefilevariable is not propagated to the C preprocessor and results in no change. This patch pushes the definition to the C code and adds a test to validate that when core.eol as native is crlf, we actually normalize text files to this line ending convention when core.autocrlf is false.Signed-off-by Pat Thoyts <[email protected]>Signed-off-by Stepan Kasal <[email protected]>Signed-off-by Torsten Bögershausen <[email protected]>---
(This is from MINGW, and some part of my brain thougth that this was send upstream, but it wasn't. Only
95f31e9ais in git.git)Makefile | 3 +++ t/t0026-eol-config.sh | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+)Makefile +3
-0@@ -1481,6 +1481,9 @@ ifdef NO_REGEX COMPAT_CFLAGS += -Icompat/regex COMPAT_OBJS += compat/regex/regex.o endif +ifdef NATIVE_CRLF + BASIC_CFLAGS += -DNATIVE_CRLF +endif ifdef USE_NED_ALLOCATOR COMPAT_CFLAGS += -Icompat/nedmalloct/t0026-eol-config.sh +0
-0
t/t0026-eol-config.sh test_expect_success 'autocrlf=true overrides unset eol' ' · line 83
Quoted 4 lines
t/t0026-eol-config.sh +1
-0@@ -80,4 +80,22 @@ test_expect_success 'autocrlf=true overrides unset eol' ' test -z "$onediff" && test -z "$twodiff" ' +test_expect_success NATIVE_CRLF 'eol native is crlf' '
Who defines this test prerequisite?
t/t0026-eol-config.sh test_expect_success 'autocrlf=true overrides unset eol' ' · line 89
Quoted 6 lines
t/t0026-eol-config.sh +6
-0+ + rm -rf native_eol && mkdir native_eol && + ( cd native_eol && + printf "*.txt text\n" > .gitattributes + printf "one\r\ntwo\r\nthree\r\n" > filedos.txt + printf "one\ntwo\nthree\n" > fileunix.txt
Style and nits:
- No SP between a redirection operator and its target.
- Broken && chain.
- Not indented.
i.e.
rm -rf native_eol &&
mkdir native_eol &&
(
cd native_eol &&
printf ... >.gitattributes &&
...
has_cr filedos.txt &&
has_cr fileunix.txt
)Quoted 12 lines
t/t0026-eol-config.sh +11
-0+ git init && + git config core.autocrlf false && + git config core.eol native && + git add filedos.txt fileunix.txt && + git commit -m "first" && + rm file*.txt && + git reset --hard HEAD && + has_cr filedos.txt && has_cr fileunix.txt + ) +' + test_done