diff options
author | Ben Straub <bs@github.com> | 2012-08-21 10:10:32 -0700 |
---|---|---|
committer | Ben Straub <bstraub@github.com> | 2012-08-21 10:55:39 -0700 |
commit | b2be351aaddc6ba0b3a0f2cf4e09536a3b27e598 (patch) | |
tree | 4b4753e91c4365c245da8450600e8f9018f2f875 | |
parent | c35881420d063c4393fef430720704f8004481a4 (diff) | |
download | libgit2-b2be351aaddc6ba0b3a0f2cf4e09536a3b27e598.tar.gz |
Win32: test core.autocrlf
-rw-r--r-- | tests-clar/checkout/checkout.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/tests-clar/checkout/checkout.c b/tests-clar/checkout/checkout.c index 35894d427..d6b79b4ac 100644 --- a/tests-clar/checkout/checkout.c +++ b/tests-clar/checkout/checkout.c @@ -59,19 +59,35 @@ void test_checkout_checkout__crlf(void) const char *attributes = "branch_file.txt text eol=crlf\n" "new.txt text eol=lf\n"; - const char *expected_readme_text = -#ifdef GIT_WIN32 - "hey there\r\n"; -#else - "hey there\n"; -#endif + git_config *cfg; + + cl_git_pass(git_repository_config__weakptr(&cfg, g_repo)); + cl_git_pass(git_config_set_bool(cfg, "core.autocrlf", false)); cl_git_mkfile("./testrepo/.gitattributes", attributes); + cl_git_pass(git_checkout_head(g_repo, NULL, NULL)); - test_file_contents("./testrepo/README", expected_readme_text); + test_file_contents("./testrepo/README", "hey there\n"); test_file_contents("./testrepo/new.txt", "my new file\n"); test_file_contents("./testrepo/branch_file.txt", "hi\r\nbye!\r\n"); } + +void test_checkout_checkout__win32_autocrlf(void) +{ +#ifdef GIT_WIN32 + git_config *cfg; + const char *expected_readme_text = "hey there\r\n"; + + cl_must_pass(p_unlink("./testrepo/.gitattributes")); + cl_git_pass(git_repository_config__weakptr(&cfg, g_repo)); + cl_git_pass(git_config_set_bool(cfg, "core.autocrlf", true)); + + cl_git_pass(git_checkout_head(g_repo, NULL, NULL)); + test_file_contents("./testrepo/README", expected_readme_text); +#endif +} + + static void enable_symlinks(bool enable) { git_config *cfg; |