mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 21:44:58 +00:00
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.
This commit is contained in:
parent
0e9f2fcef6
commit
52462e1cce
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user