summaryrefslogtreecommitdiff
path: root/tests-clar/checkout/index.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-01-04 17:17:37 -0800
committerRussell Belfer <rb@github.com>2013-01-04 17:17:37 -0800
commit2f0895393dee641c560cd9a54cc8e5d0b0384f01 (patch)
tree0b490ffefc2bdf3e49c20c01b5aa32cbbc001ff5 /tests-clar/checkout/index.c
parentbebdbcd442fb9b050589e9d7ba311850b0807f71 (diff)
downloadlibgit2-2f0895393dee641c560cd9a54cc8e5d0b0384f01.tar.gz
Actually fix win32 checkout test
It turns out that using REMOVE_UNTRACKED with checkout for this particular test was causing the .gitattributes file to be removed and so we do have to allow for the CRs in the created file...
Diffstat (limited to 'tests-clar/checkout/index.c')
-rw-r--r--tests-clar/checkout/index.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests-clar/checkout/index.c b/tests-clar/checkout/index.c
index 49e7093b8..2dc08715d 100644
--- a/tests-clar/checkout/index.c
+++ b/tests-clar/checkout/index.c
@@ -470,6 +470,10 @@ void test_checkout_index__can_update_prefixed_files(void)
{
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
+ cl_assert_equal_i(false, git_path_isfile("./testrepo/README"));
+ cl_assert_equal_i(false, git_path_isfile("./testrepo/branch_file.txt"));
+ cl_assert_equal_i(false, git_path_isfile("./testrepo/new.txt"));
+
cl_git_mkfile("./testrepo/READ", "content\n");
cl_git_mkfile("./testrepo/README.after", "content\n");
cl_git_pass(p_mkdir("./testrepo/branch_file", 0777));
@@ -477,13 +481,17 @@ void test_checkout_index__can_update_prefixed_files(void)
cl_git_mkfile("./testrepo/branch_file/contained_file", "content\n");
cl_git_pass(p_mkdir("./testrepo/branch_file.txt.after", 0777));
- opts.checkout_strategy = GIT_CHECKOUT_FORCE | GIT_CHECKOUT_REMOVE_UNTRACKED;
+ opts.checkout_strategy =
+ GIT_CHECKOUT_SAFE_CREATE | GIT_CHECKOUT_REMOVE_UNTRACKED;
cl_git_pass(git_checkout_index(g_repo, NULL, &opts));
- test_file_contents("./testrepo/README", "hey there\n");
- test_file_contents("./testrepo/branch_file.txt", "hi\nbye!\n");
- test_file_contents("./testrepo/new.txt", "my new file\n");
+ /* remove untracked will remove the .gitattributes file before the blobs
+ * were created, so they will have had crlf filtering applied on Windows
+ */
+ test_file_contents_nocr("./testrepo/README", "hey there\n");
+ test_file_contents_nocr("./testrepo/branch_file.txt", "hi\nbye!\n");
+ test_file_contents_nocr("./testrepo/new.txt", "my new file\n");
cl_assert(!git_path_exists("testrepo/READ"));
cl_assert(!git_path_exists("testrepo/README.after"));