From d412165f948b77bf548234fd46fb0743f6afc3ed Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Wed, 18 Jun 2014 16:54:32 -0500 Subject: [PATCH] Update text=auto / core.autocrlf=false behavior Git for Windows 1.9.4 changed the behavior when the text=auto attribute is specified and core.autocrlf=false. Previous observed behavior would *not* filter files when going into the working directory, the new behavior *does* filter. Update our behavior to match. --- CHANGELOG.md | 3 +++ src/crlf.c | 3 ++- tests/checkout/crlf.c | 9 +++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61fc1cfdb..561df946a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,3 +9,6 @@ v0.21 + 1 * Use a map for the treebuilder, making insertion O(1) * LF -> CRLF filter refuses to handle mixed-EOL files + +* LF -> CRLF filter now runs when * text = auto (with Git for Windows 1.9.4) + diff --git a/src/crlf.c b/src/crlf.c index 821e04eb2..93448760d 100644 --- a/src/crlf.c +++ b/src/crlf.c @@ -286,7 +286,8 @@ static int crlf_check( if (error < 0) return error; - if (ca.auto_crlf == GIT_AUTO_CRLF_FALSE) + if (ca.crlf_action == GIT_CRLF_GUESS && + ca.auto_crlf == GIT_AUTO_CRLF_FALSE) return GIT_PASSTHROUGH; if (ca.auto_crlf == GIT_AUTO_CRLF_INPUT && diff --git a/tests/checkout/crlf.c b/tests/checkout/crlf.c index 2c84a77f3..496f83d5d 100644 --- a/tests/checkout/crlf.c +++ b/tests/checkout/crlf.c @@ -279,8 +279,13 @@ void test_checkout_crlf__autocrlf_false_text_auto_attr(void) git_checkout_head(g_repo, &opts); - check_file_contents("./crlf/all-lf", ALL_LF_TEXT_RAW); - check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_RAW); + if (GIT_EOL_NATIVE == GIT_EOL_CRLF) { + check_file_contents("./crlf/all-lf", ALL_LF_TEXT_AS_CRLF); + check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_AS_CRLF); + } else { + check_file_contents("./crlf/all-lf", ALL_LF_TEXT_RAW); + check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_RAW); + } } void test_checkout_crlf__autocrlf_true_text_auto_attr(void)