From fc66b9b4f0be47f171624b710bba31dde5536aef Mon Sep 17 00:00:00 2001 From: Ivan Semenov Date: Mon, 20 Nov 2017 17:34:25 +0300 Subject: [PATCH] Fix GitCrlfProblemsDetectorTest --- .../crlf/GitCrlfProblemsDetectorTest.java | 37 +------------------ 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/plugins/git4idea/tests/git4idea/crlf/GitCrlfProblemsDetectorTest.java b/plugins/git4idea/tests/git4idea/crlf/GitCrlfProblemsDetectorTest.java index 8c92f2897bf3..8f1926a6ce00 100644 --- a/plugins/git4idea/tests/git4idea/crlf/GitCrlfProblemsDetectorTest.java +++ b/plugins/git4idea/tests/git4idea/crlf/GitCrlfProblemsDetectorTest.java @@ -17,10 +17,6 @@ import java.util.List; import static java.util.Arrays.asList; public class GitCrlfProblemsDetectorTest extends GitSingleRepoTest { - - private String myOldGlobalAutoCrlfValue; - private String myOldSystemAutoCrlfValue; - public void setUp() throws Exception { try { super.setUp(); @@ -30,31 +26,7 @@ public class GitCrlfProblemsDetectorTest extends GitSingleRepoTest { throw e; } Executor.cd(projectRoot); - try { - myOldGlobalAutoCrlfValue = git("config --global core.autocrlf", true); - git("config --global --unset core.autocrlf", true); - } - catch (Exception e) { - System.out.println("Couldn't operate with global config: " + e.getMessage()); - } - - myOldSystemAutoCrlfValue = git("config --system core.autocrlf", true); - git("config --system --unset core.autocrlf", true); - } - - public void tearDown() throws Exception { - try { - if (!StringUtil.isEmptyOrSpaces(myOldGlobalAutoCrlfValue)) { - git("config --global core.autocrlf " + myOldGlobalAutoCrlfValue); - } - - if (!StringUtil.isEmptyOrSpaces(myOldSystemAutoCrlfValue)) { - git("config --system core.autocrlf " + myOldSystemAutoCrlfValue); - } - } - finally { - super.tearDown(); - } + git("config core.autocrlf false"); } public void test_no_warning_if_autocrlf_is_true() throws IOException { @@ -72,11 +44,6 @@ public class GitCrlfProblemsDetectorTest extends GitSingleRepoTest { assertFalse("No warning should be done if all files are LFs", detect("temp").shouldWarn()); } - public void test_no_warning_if_file_with_CRLF_no_attrs_autocrlf_is_false() throws IOException { - createCrlfFile("win"); - assertFalse("Warning should be done for a CRLF file with core.autocrlf = false", detect("temp").shouldWarn()); - } - public void test_no_warning_if_file_with_CRLF_but_text_is_set() throws IOException { gitattributes("* text=auto"); createCrlfFile("win"); @@ -101,7 +68,7 @@ public class GitCrlfProblemsDetectorTest extends GitSingleRepoTest { assertFalse("No warning should be done if the file has a crlf attribute", detect("win").shouldWarn()); } - public void test_warning_if_file_with_CRLF_nothing_is_set() throws IOException { + public void test_warning_if_file_with_CRLF_no_attrs_autocrlf_is_false() throws IOException { createCrlfFile("win"); assertTrue("Warning should be done if the file has CRLFs inside, and no explicit attributes", detect("win").shouldWarn()); }