{"thread":{"id":"37461","subject":"[PATCH v3 1/2] Push the NATIVE_CRLF Makefile variable to C and added a test for native.","startedAt":"2014-08-30T21:38:59Z","lastAt":"2014-09-02T19:03:05Z","messageCount":2,"participants":["Torsten Bögershausen","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":2},"messages":[{"id":"248665","messageId":"54024473.4040709@web.de","threadId":"37461","inReplyTo":null,"subject":"[PATCH v3 1/2] Push the NATIVE_CRLF Makefile variable to C and added a test for native.","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-08-30T21:38:59Z","receivedAt":"2014-08-30T21:38:59Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"From: Pat Thoyts <patthoyts@users.sourceforge.net>\n\nCommit 95f31e9a correctly points out that the NATIVE_CRLF setting is\nincorrectly set on Mingw git. However, the Makefile variable is not\npropagated to the C preprocessor and results in no change. This patch\npushes the definition to the C code and adds a test to validate that\nwhen core.eol as native is crlf, we actually normalize text files to this\nline ending convention when core.autocrlf is false.\n\nSigned-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\nSigned-off-by: Stepan Kasal <kasal@ucw.cz>\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\nThis mini series mainly updates git.git with patches from msysgit:\nPatch 1 is taken \"as is\",\nPatch 2 is taken from msysgit \"nearly as is\": the broken && chain\nhad been fixed.\n\nChanges since V2:\n- Patch 1 shoud have the right Author line\n (I used git-send-email for V2, where the Author was lost:\n  web.de does not allow to send mails with \"From: Pat Thoyts\" in the\n  mail header, so it will change it to \"From: tboegi\".\n  And git-send-email does not add another\n  \"From: \" line into the subject of the email, so I did it by hand)\n\nPatch 2+3 had been squeezed together\n(This may make the integration in msysgit a liitle bit harder)\n\n Makefile              |  3 +++\n t/t0026-eol-config.sh | 18 ++++++++++++++++++\n 2 files changed, 21 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex 9f984a9..7d7db02 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1479,6 +1479,9 @@ ifdef NO_REGEX\n \tCOMPAT_CFLAGS += -Icompat/regex\n \tCOMPAT_OBJS += compat/regex/regex.o\n endif\n+ifdef NATIVE_CRLF\n+\tBASIC_CFLAGS += -DNATIVE_CRLF\n+endif\n \n ifdef USE_NED_ALLOCATOR\n        COMPAT_CFLAGS += -Icompat/nedmalloc\ndiff --git a/t/t0026-eol-config.sh b/t/t0026-eol-config.sh\nindex 4807b0f..43a580a 100755\n--- a/t/t0026-eol-config.sh\n+++ b/t/t0026-eol-config.sh\n@@ -80,4 +80,22 @@ test_expect_success 'autocrlf=true overrides unset eol' '\n \ttest -z \"$onediff\" && test -z \"$twodiff\"\n '\n \n+test_expect_success NATIVE_CRLF 'eol native is crlf' '\n+\n+\trm -rf native_eol && mkdir native_eol &&\n+\t( cd native_eol &&\n+\tprintf \"*.txt text\\n\" > .gitattributes\n+\tprintf \"one\\r\\ntwo\\r\\nthree\\r\\n\" > filedos.txt\n+\tprintf \"one\\ntwo\\nthree\\n\" > fileunix.txt\n+\tgit init &&\n+\tgit config core.autocrlf false &&\n+\tgit config core.eol native &&\n+\tgit add filedos.txt fileunix.txt &&\n+\tgit commit -m \"first\" &&\n+\trm file*.txt &&\n+\tgit reset --hard HEAD &&\n+\thas_cr filedos.txt && has_cr fileunix.txt\n+\t)\n+'\n+\n test_done\n-- \n2.1.0.rc2.210.g636bceb\n"},{"id":"248729","messageId":"xmqq61h526c6.fsf@gitster.dls.corp.google.com","threadId":"37461","inReplyTo":"54024473.4040709@web.de","subject":"Re: [PATCH v3 1/2] Push the NATIVE_CRLF Makefile variable to C and added a test for native.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-09-02T19:03:05Z","receivedAt":"2014-09-02T19:03:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Torsten Bögershausen <tboegi@web.de> writes:\n\n> From: Pat Thoyts <patthoyts@users.sourceforge.net>\n>\n> Commit 95f31e9a correctly points out that the NATIVE_CRLF setting is\n> incorrectly set on Mingw git. However, the Makefile variable is not\n> propagated to the C preprocessor and results in no change. This patch\n> pushes the definition to the C code and adds a test to validate that\n> when core.eol as native is crlf, we actually normalize text files to this\n> line ending convention when core.autocrlf is false.\n>\n> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n> Signed-off-by: Stepan Kasal <kasal@ucw.cz>\n> Signed-off-by: Torsten Bögershausen <tboegi@web.de>\n> ---\n> This mini series mainly updates git.git with patches from msysgit:\n> Patch 1 is taken \"as is\",\n> Patch 2 is taken from msysgit \"nearly as is\": the broken && chain\n> had been fixed.\n\nShouldn't Patch 1 also be made \"nearly as is\" to fix the same?\n"}]}