summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2013-10-24 22:35:34 +0200
committernulltoken <emeric.fermas@gmail.com>2013-10-25 23:49:48 +0200
commit99e96906f5682cb2841c11e983bd337267d4813e (patch)
treeb2636b7e0f6eabb0609f668c51efb8071c179c17
parentfd5d80d25ae50b9f6491868e4e5c06ea017bbdb0 (diff)
downloadlibgit2-99e96906f5682cb2841c11e983bd337267d4813e.tar.gz
Add clar test to help troubleshooting libgit2/libgit2sharp#543
-rw-r--r--tests-clar/object/blob/filter.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests-clar/object/blob/filter.c b/tests-clar/object/blob/filter.c
index 0b2d6bf9e..bbb2e5512 100644
--- a/tests-clar/object/blob/filter.c
+++ b/tests-clar/object/blob/filter.c
@@ -141,3 +141,28 @@ void test_object_blob_filter__to_odb(void)
git_buf_free(&out);
git_config_free(cfg);
}
+
+void test_object_blob_filter__honor_core_autocrlf(void)
+{
+ git_blob *blob;
+ git_buf buf = GIT_BUF_INIT;
+ git_config *config;
+
+ cl_git_pass(git_repository_config(&config, g_repo));
+
+ cl_git_pass(git_blob_lookup(&blob, g_repo, &g_crlf_oids[1]));
+
+ cl_git_pass(git_config_set_string(config, "core.autocrlf", "true"));
+
+ cl_git_pass(git_blob_filtered_content(&buf, blob, "foo.txt", false));
+ cl_assert_equal_s("foo\r\nbar\r\n", git_buf_cstr(&buf));
+
+ cl_git_pass(git_config_set_string(config, "core.autocrlf", "input"));
+
+ cl_git_pass(git_blob_filtered_content(&buf, blob, "foo.txt", false));
+ cl_assert_equal_s("foo\nbar\n", git_buf_cstr(&buf));
+
+ git_config_free(config);
+ git_buf_free(&buf);
+ git_blob_free(blob);
+}