Commit 52462e1c by pontusm Committed by Russell Belfer

Test case to reproduce issue #690.

Staged file status does not handle CRLF correctly. Ensures that the test repo has core.autocrlf=true for the test to fail.
parent 0e9f2fce
......@@ -797,3 +797,30 @@ void test_status_worktree__interruptable_foreach(void)
cl_assert_equal_i(8, count);
}
void test_status_worktree__new_staged_file_must_handle_crlf(void)
{
git_repository *repo;
git_index *index;
git_config *config;
unsigned int status;
cl_git_pass(git_repository_init(&repo, "getting_started", 0));
// Ensure that repo has core.autocrlf=true
cl_git_pass(git_repository_config(&config, repo));
cl_git_pass(git_config_set_bool(config, "core.autocrlf", true));
cl_git_mkfile("getting_started/testfile.txt", "content\r\n"); // Content with CRLF
cl_git_pass(git_repository_index(&index, repo));
cl_git_pass(git_index_add(index, "testfile.txt", 0));
cl_git_pass(git_index_write(index));
cl_git_pass(git_status_file(&status, repo, "testfile.txt"));
cl_assert_equal_i(GIT_STATUS_INDEX_NEW, status);
git_config_free(config);
git_index_free(index);
git_repository_free(repo);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment